Dear community.
I am trying to synchronize the status of the groups of AD in ServiceNow.
ServiceNow has a field called active that can be true or false (Boolean). As the groups in AD don't have this field, I am checking if the group is in a certain OU and returning true or false accordingly.
However, I get an error "String was not recognized as a valid Boolean."
This is the code
$GroupName = $srcObj["name"];
$Logfile = "C:\Temp\DebugStatus.txt"
[bool] $active
Connect-QADService -proxy
$dN = (Get-QADGroup -identity $GroupName ).DirectoryEntry.distinguishedName
if ($dN -like '*,OU=Deprovisioned Groups,*')
{
$active=$false
$message = $active.gettype().fullname
Add-Content $Logfile $message
$message = $GroupName + $active
Add-Content $Logfile $message
}
else
{
$active=$true
$message = $active.gettype().fullname
Add-Content $Logfile $message
$message = $GroupName + $active
Add-Content $Logfile $message
}
return $active;
I have tried passing directly $false, $true, 0, 1 ....
In the log file that I create for the checking of the script I get this (which is type, group name and content of the boolean variable)
System.Boolean
Test deprovisioned group False
Can you tell me how should I specify to get it done?
Best regards