Welcome to Powergui.org - an open source community for Windows Powershell

PowerGUI.org PowerGUI.org and blogs

Forums » Request a Script

Thread: Find computeres where local administrator = XXXX

This question is answered. Helpful answers available: 2. Answered answers available: 1.


Permlink Replies: 2 - Pages: 1 - Last Post: Jun 25, 2012 9:10 AM by: Luco13
Luco13

Posts: 22
Registered: 2/25/10
Find computeres where local administrator = XXXX
Posted: Jun 22, 2012 3:12 PM
 
  Click to reply to this thread Reply

Looking for a script that will search an OU and find all computer objects that have had the local administrator account change to XXXXX.

I then need to takee those computers that have the XXX account and rename it back to administrator.

Any assitance would be greatly appreciated!

Thanks


Art Beane

Posts: 747
Registered: 4/23/09
Re: Find computeres where local administrator = XXXX
Posted: Jun 22, 2012 7:45 PM   in response to: Luco13
 
  Click to reply to this thread Reply

The local adminstrator is not stored in AD, but you can get the list of computers from an OU and then use WMI to collect the local adminstrator information. You'll find lots of blogs with information to get you going. Try searching for "PowerShell manage local administrator". You'll find lots of results. Here's a quick sample:

http://gallery.technet.microsoft.com/scriptcenter/f99a701a-a8f5-489f-8c30-77b6bf1e8ffd
http://jdhitsolutions.com/blog/2011/07/get-local-administrators-with-wmi-and-powershell/
http://blogs.technet.com/b/heyscriptingguy/archive/2008/03/11/how-can-i-use-windows-powershell-to-add-a-domain-user-to-a-local-group.aspx


Luco13

Posts: 22
Registered: 2/25/10
Re: Find computeres where local administrator = XXXX
Posted: Jun 23, 2012 2:46 PM   in response to: Art Beane
 
  Click to reply to this thread Reply

My apoligies for not being clear. I understand this information is not stored in AD. I was just using the AD OU as my source for the host names since they all reside in a single location. I could just as easy used s CSV file with the names. 

Thanks for the links,

Mike

Message was edited by: Luco13 Message was edited by: Luco13


Legend
MVP: 2501 + pts
Guru: 2001 - 2500 pts
Expert: 751 - 2000 pts
Enthusiast: 31 - 750 pts
Novice: 0 - 30 pts
Moderators
Helpful answer (5 pts)
Answered (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums