Link to home
Start Free TrialLog in
Avatar of Terellion
TerellionFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Retrieve Local Admins via Powershell

Hey guys, i'd like a script to run to retrieve the list of local Administrators of a group of servers but only match certain users.

So something like

(Get-WMIObject Win32_Group | Where-Object { $_.Name –eq ‘Administrators’ }).GetRelated() | Where-Object { $_.__CLASS –eq “Win32_UserAccount” –or $_.__CLASS –eq “Win32_Group” } | Select-Object __CLASS,Caption,SID


But have a where-object that includes a certain user (just so we can identify if a user has local admin to any server.

Thanks for your help :)
Avatar of Tej Pratap Shukla ~Dexter
Tej Pratap Shukla ~Dexter
Flag of India image

Hi..

Follow the link for script to retrive local admins

http://andrewmorgan.ie/2011/06/retrieve-a-list-of-local-administrators-using-powershell/

Thanks
Dexter
Avatar of Terellion

ASKER

Hi there, thanks for that. Do you know how to filter this down though so it only shows certain users?
SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Subsun, thats brilliant! Is there a way to only show the ones that say Member - Yes? Thanks!
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That is absolutely superb, works a treat THANK YOU! :)