diff --git a/GetInfoFromUniqueId.ps1 b/GetInfoFromUniqueId.ps1 index 454dc62..35d74b2 100644 --- a/GetInfoFromUniqueId.ps1 +++ b/GetInfoFromUniqueId.ps1 @@ -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)" } @@ -58,4 +55,7 @@ foreach($object in $returnedObjects.Policies) { } return } -} \ No newline at end of file +} + +Write-Output "Unique ID '$target' not found" +exit