I need to list all the AD groups a server belongs to and I have a list of servers. I can get the list of groups:
(Get-ADComputer bounce3 -Property MemberOf).MemberOf -replace '^CN=([^,]+),OU=.+$','$1'
And I have a script to enumerate the ser list using Get-Content and a foreach command.
I'm having issues with output. I need:
ServerName
List of Groups
I can get either, but not both. I have tried Export.csv and outfile.txt commands.
Any help would be appreciated.