advserver
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!
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!
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?
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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!
Do I put the workstations in the txt document instead of server names? Also, will the workstations need Powershell installed on them? Thank you!
ASKER
Worked well enough for me. Thank you very much!
Hi,
Yes, you can put Workstation name in place of desktop. You don't need to install powershell on the work stations.
Regards,
Krishna
Yes, you can put Workstation name in place of desktop. You don't need to install powershell on the work stations.
Regards,
Krishna
http://briandesmond.com/blog/script-to-collect-local-administrators-membership-from-list-of-machines/
Popular answer here....