Added error if resource can't be found for GetInfoFromUniqueId.ps1

This commit is contained in:
Oscar Pocock 2023-01-20 16:33:26 +00:00
parent af6db0eaeb
commit cf16558acc

View file

@ -43,10 +43,7 @@ else {
}
foreach($object in $returnedObjects.Policies) {
if ($objectFound -eq $true) {
break
}
elseif ("$target" -eq "$($object.PolicyId)") {
if ("$target" -eq "$($object.PolicyId)") {
if ($name -eq $true) {
Write-Output "$($object.PolicyName)"
}
@ -59,3 +56,6 @@ foreach($object in $returnedObjects.Policies) {
return
}
}
Write-Output "Unique ID '$target' not found"
exit