Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Help to outpur the AD groups to which a list of a computers belong

$
0
0

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.


Viewing all articles
Browse latest Browse all 21975

Trending Articles