Link to home
Start Free TrialLog in
Avatar of advserver
advserverFlag for United States of America

asked on

Need Script to view who has local admin rights on domain xp pro workstations.

2003 Active Directory Domain.
Windows XP Professional workstations

Need to be able to run a script which shows the Local Administrator rights on each XP Pro workstation.

Thank you!
Avatar of johnb6767
johnb6767
Flag of United States of America image

Script to Collect Local Administrators Membership from List of Machines
http://briandesmond.com/blog/script-to-collect-local-administrators-membership-from-list-of-machines/

Popular answer here....
Avatar of advserver

ASKER

John,
Thank you very much for your post!  Sorry for the delay!  The client stated that they are looking for something like what is pasted below.  The code is almost complete but it needs the ability to write in the file over and over again.  Can you see what it is missing?


'create an instance of the Wscript Network object; using the (2) objects
Set objNetwork = CreateObject("Wscript.Network")

'set your strings
strComputer = objNetwork.ComputerName
strUser = objNetwork.UserName

'set variables for the write process
Dim Filesys, WriteFiletxt

Set Filesys = CreateObject("Scripting.FileSystemObject") 
Set WriteFiletxt = Filesys.CreateTextFile("c:\local-admin.txt", false)

'use the WinNT provider to bind to the Administrators group on the computer in question
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")

'set up For Each loop to walk through the group membership
For Each objUser in objGroup.Members
    If objUser.Name = strUser Then

'Write output to the text file listed above
     WriteFiletxt.WriteLine strUser & " Has Administrator Rights. "

 End If
Next

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of krishnasmtpport25
krishnasmtpport25

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
Thank you Krishna.

Do I put the workstations in the txt document instead of server names?  Also, will the workstations need Powershell installed on them?  Thank you!

Worked well enough for me.  Thank you very much!
Avatar of krishnasmtpport25
krishnasmtpport25

Hi,

Yes, you can put Workstation name in place of desktop. You don't need to install powershell on the work stations.

Regards,
Krishna