Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

works on windows 2000 workstation but not on Windows XP

Status
Not open for further replies.

vttech

Technical User
Jan 28, 2006
297
US
This script works great on windows 2000 OS but does not work on Windows XP. Can someone help me figure this out??



Using Group Policy and a Script to Remove everyone except the administrator and the domain admins group form the local administrators group of workstations on CHCB domain.


strComputer = "."

Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")

For Each objUser In objGroup.Members
If objUser.Name <> "Administrator" and objUser.Name <> "Domain Admins" Then
objGroup.Remove(objUser.AdsPath)
End If
Next
 
I tried the following on mine (XP SP2) and it worked fine.

I didn't let it remove anything, but I don't see why it would not work..

David

strComputer = "."
strMessage = ""
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")

For Each objUser In objGroup.Members
If objUser.Name <> "Administrator" and objUser.Name <> "Domain Admins" Then

'Remove Remark Below to Actually remove them pesky users
' objGroup.Remove(objUser.AdsPath)

strMessage = strMessage + objUser.Name & ", "
wscript.echo "The ADS Path for the last user is" & objUser.AdsPath
End If
Next

Wscript.echo "The Following Pesky Non Admin Users were Removed from the local admin group" & Vbcrlf & Vbcrlf & strMessage
 
Sorry I didn't put all the info. It works on XP when you login as account and run the script. But when I


Created an OU in active diretory users and computers call TestEnviroment.
Created a GPO called "RemoveUsers"

Computer Configuration --> Windows Settings --> Scripts(Startup/Shutdown) --> Startup

added localaccount.vbs script

when my windows 2000 clients boot it works. But the script does not work with my Windows XP cleints..

 
windowsxp doesnt use "winnt" as the system folder isnt it "windows"

so you want %system% or something like that?


Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top