Get-ADGroup “GROUP1” | Add-ADGroupMember -Identity “GROUP2” -Members $_.ObjectGUID
Add-ADGroupMember : Cannot validate argument on parameter ‘Members’. The argument is null or empty. Provide an argument that is not null
or empty, and then try the command again.
So unfortunately I have written like 400 lines of these commands and I know I can change the command to this but that means modifying roughly 400 lines of code. Any idea what I’m doing wrong? I have tried multiple ways of entering the pipeline data without success.
I could probably modify the code to do a foreach down to about 100 lines of code but still modifying a ton of code. For me easier to just find a way to do a find and replace if it is possible.