RE: Local Administrator username & password change
- From: M. Helmy <MHelmy@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 8 Nov 2006 07:10:02 -0800
"Vijesh Rajan" wrote:
Hi,
We have Windows 2003 Domain and windows XP and Windows 2000 as client
computers. As per our company policy we have to change the local
administrator name and password once in 2 month. Please let me know how can
we change the local administrators User name and Password of Windows XP/2000
Proffesional clients using group policy.
The below vbs script can be used as a Group Policy Startup Script, this
script renames the local administrator account and then change its password:
Instructions:
1- Copy the Script in a file .vbs
2- Replace the word "NewAdmin" with the desired new local administrator name.
3- Replace the word "P@ssword" by the desired new local administrator password
Script:
' Script Begin
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colAccounts = objWMIService.ExecQuery _
("Select * From Win32_UserAccount Where LocalAccount = True And Name =
'Administrator'")
For Each objAccount in colAccounts
objAccount.Rename "NewAdmin"
Next
Dim WshShell, oExec
Password ="P@ssw0rd"
strCommand = "net user NewAdmin " & Password
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec(strCommand)
Do While oExec.Status = 0
WScript.Sleep 100
Loop
' Script End
And is their any way that we can get any report from group policy that how
many users have local administrator rights.
The below vbs script exports the members of the local administrators group
of a list of machines and saved them in a file:
Instructions:
1- Copy the script in a file .vbs
2- Create a file named "MachinesList.txt" on your C: Drive.
3- Write your list of machines you want to know their local admins in the
"MachinesList.txt" file (one machine name per line)
4- Create an empty file named "LocalAminsList.txt" on your C: Drive, this
file will be used to store the output list, this list will contain the
machine name and the members of the local admins group each per line in a CSV
format (can be opened using Excel)
Script:
'Script Begin
Const ForReading =1, ForWriting =2, ForAppending =8
Set fso = CreateObject ("Scripting.FileSystemObject")
Set f = fso.OpenTextFile ("c:\MachinesList.txt", ForReading)
Do While f.AtEndOfStream <> True
ReadLineText = f.ReadLine
GroupString = "Administrators"
Set GroupObj = GetObject("WinNT://" & ReadLineText & "/" & GroupString)
For each UserObj in GroupObj.Members
List = List & "," & UserObj.Name
Next
Set fso2 = CreateObject("Scripting.FileSystemObject")
Set f2 = fso2.OpenTextFile("c:\LocalAminsList.txt", ForAppending , False)
f2.Write ReadLineText & List & VbCrLf
f2.Close
List = ""
Loop
'Script End
If you need any further info please dont hesitate to contact me.
Regards,
Please let me know the solution for above 2 queries.
Thanks,
Regards,
Vijesh Rajan
.
- Prev by Date: Disable users to plug removable media
- Next by Date: Re: Disable users to plug removable media
- Previous by thread: Re: Local Administrator username & password change
- Next by thread: Disable users to plug removable media
- Index(es):
Relevant Pages
|