Open yanlu2 opened 2 years ago
The loop near the end of the script has a lot of splitting on characters, specifically the comma. If there is something off/missing with the input file, it could cause all sorts of errors, especially the kind where it works one day and not the next.
I'd suggest adding a line where you write out the variable values to the screen right before you run the Get-SsoPersonUser line, just so you can see if there is some issue with text parsing prior to errors being throw.
Also, is $path+$hostname+"-grpmbr.txt"
actually a CSV file? If so, it might be easier to use Import-Csv
instead of Get-Content
, because that can deal a bit better with changing input files. For example, I've seen CSV files contain text that looks like both of the following rows:
Group,OldUser,Email,NewUser
"Group","OldUser","Email","NewUser"
If you are splitting on commas expecting the format from the first line, but your file actually has the second, that could inject unneeded quotes into your actual variable values.
Hello @yanlu2 - I wanted to follow up on this issue -- I noticed you closed out Issues #530 and #534 but was curious if the issue described here in #532 was still applicable? Thanks!
Describe the bug
@bwuch
I have tested and followed run script second time failed #530. but it seems got another error see update in #530 and made this error. I got error when I run command Get-SsoPersonUser -Name $oldusername -Domain $corpdomain | Remove-UserFromSsoGroup -TargetGroup $vcgroup
PS C:\Users\luy13> Get-SsoPersonUser -Name $oldusername -Domain $corpdomain | Remove-UserFromSsoGroup -TargetGroup $vcgroup Remove-UserFromSsoGroup : One or more errors occurred. At line:1 char:60
Reproduction steps
Expected behavior
the scirpt should remove user from group. and it worked yesterday.
Additional context
No response