Hi there, I have got a script that will get list of users in Admins group in a system. Can you please share how I can get members of groups in Administrators user group in a system. I am trying to get an out like one mentioned below -
Members in Administrators group -
Tom Tom (AD Users)
Harry Harry (AD Users)
MARKETING (AD Group)
Tim Tim (User in Marketing Group)
Laura Laura (User in Marketing Group)
[quote quote=242810]If you want all the admins listed you could do
Invoke-Command -ComputerName $servers -ScriptBlock { [pscustomobject]@{ Server = $env:COMPUTERNAME Admins = (Get-LocalGroupMember -Group “Administrators”) } } | select server,@{n=“admins”;e={$_.admins -join ", "}} | out-file $output -encoding ASCII You may want to export it as a CSV, not sure how you plan to consume it. Take care.
[/quote]
Hi Dough, Thank you for that update, I tried I still get the same output. My apologies for the delayed reply as I was on vacation. I can post the out put tomorrow.