The string was not recognized as a valid DateTime. There is an unknown word starting at index 0.

Good morning.

I am working on script to synchronize data from Servicenow to Active Roles. To do that, i have created a sync step in which SNOW is the source and ARS the target. In the updating rules, I have a forward sync rule in which I run my script.

The script basically modify the members of a given group from SNOW, using the Remove-QADGroupMember -Identity ($GroupName) -Member $c[$i] -Confirm:$false -Control @{'OperationReason'="Set by script"} // add-qadgroupmember -identity ($GroupName) -member $c[$i] -Control @{'OperationReason'="Set by script"}. This removes or add users to the group and create an entry in the change history.

However, as it is a sync task, I cannot get it working totally, always getting an error. In the beginning, I was synching the "members" target item (ARS attribute) and getting an error as the content of the members change before the script finishes.

Then I decided to try other options. First i went for one of the "Custom Attributes 10" that are available and there I got an error message saying that the attribute can only contain on value. What I could see in the details of the result window is that each user that were removed or added were included in the attribute + a "ActiveRoles.ManagementShell.Data.ArsServerConnection", that comes from the "Connect-QADService -proxy" to get the changes registered in the change history.

So the content of Custom attribute 10 would be ActiveRoles.ManagementShell.Data.ArsServerConnection, user1, user2, (blank). I added the blank with "Return $Null" to leave the attibute blank.
Then I tried with "WhenChanged" attribute and adding the current date with "[DateTime]$date=Get-Date -Format "dd.MM.yyyy HH:mm:ss"" // return $date, getting the error of the subject. i have tried with and without declaring the type of $date, and changing the format to how it is currently registered.

I have also tried to use "Flags" attribute, integer, giving some similar type error.

So I am assuming that every time that the users are added/deleted, they are added to the target item.

After the long explanation, the question, is there a way of pass only the result needed, independently of what the script does?

Would you do this in a different way? I cannot use a direct connection with SNOW, if you are going to suggest that.

Best regards

Top Replies