As Michael said in its comment, the item may be null. I did a quick test locally and below is the result
I've used the Item Id of the default Home item and the result shows that the item is not null.
$item = Get-Item -Path master -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"
if($item -ne $null){
Write-Host "Item is not null"
}
else{
Write-Host "Item null"
}
However, when I change the ID to something which does not exist, the result is still shown as PSCustomObject
but it shows that the item is null.
So, you need to check for null on the variable $GetImage
.
$GetImage= Get-Item -Path master: -ID $parsedID
if($GetImage -ne $null){
# Process item here
}
else{
Write-Host "Skipping item id $parsedID as it is null"
}
[PSCustomObject]
instead of null?if($GetImage -eq $null { Write-Host "It's null!" }