RE: Local Administrator username & password change





"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

.



Relevant Pages

  • Re: scripted logon
    ... Why can't you launch all the scripts from a Group Policy based Logon script. ... Here's the policy settings (I sure hope word wrap doesn't mess it up too ... Windows Components/Windows Installer ...
    (microsoft.public.windows.terminal_services)
  • Re: Logon script in Group Policy not working.
    ... Seems like your script doesn't run at all, ... Maybe your policy isn't applied at all. ... permissions to add network printers and a correct path. ... MCSA Windows 2003 server ...
    (microsoft.public.windows.terminal_services)
  • Re: HOWTO Run CASPOL for full trust on UserControl.
    ... I was using "login script" in the general sense of a script pushed ... account and can modify CAS policy. ... However, in most Windows domain ... caspol command lines. ...
    (microsoft.public.dotnet.security)
  • RE: Login script
    ... I am running the login script using dos batch file or vbs script. ... scripts are implemented via Group Policy. ... How to use the Group Policy Migration utility to migrate Windows NT System ... Regarding Wins server migration, you can refer to following article: ...
    (microsoft.public.windows.server.migration)
  • Re: Microsoft Warns of New Windows Flaw (March 19, 2003 )
    ... In WINDOWS SETUP in ADD/REMOVE PROGRAMS of Control Panel ... Uninstall Outlook Express, ... Java, Javascript, ActiveX and all the other script runner toys Billy ... Install WebWasher the spammers are terrified of free from ...
    (comp.security.misc)