changing local admin password

  • Thread starter Thread starter browser
  • Start date Start date
Yes, you can write a script that changes local admin password, and assign it
as a startup script for the entire domain or any OU you want.

--
Dmitry Korolyov [[email protected]]
MVP: Windows Server - Active Directory


can i change local admin pass users in a domain at once ?
thanks...
 
Sure, here's an example:

' BEGIN SCRIPT -------------------------------------
Dim Container
Dim ContainerName
Dim User, UsrSID, b
Dim WshNetwork

Set WshNetwork = WScript.CreateObject("WScript.Network")
ComputerName=WshNetwork.ComputerName

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & ComputerName & "\root\cimv2")

strSelect="Select * from Win32_UserAccount"

Set colSystemUsers = objWMIService.ExecQuery (strSelect)

For Each objSystemUser in colSystemUsers
if Right(objSystemUser.SID,3)="500" Then
Set objUser = GetObject("WinNT://" & ComputerName & "/" &
objSystemUser.Name & ",user")
NewPassword="MySuperPasswordNoBodyWouldGuess"
Call objUser.SetPassword(NewPassword)
Exit For
End If
Next
' END SCRIPT ---------------------------------------

The script works with any renamed built-in administrator account as it uses
RID lookup instead of name lookup (built-in administrator account always has
RID=500).

--
Dmitry Korolyov [[email protected]]
MVP: Windows Server - Active Directory


Dimitry,
can you help me for writing script.
thanks...
 
Could you also use this script to rename any local ADministrator account
back to "Administrator" ?
 
Nope the script doesn't rename administrator account. THe best way to rename
built-in administrator account is to do it using Group Policy (Computer
Configuration\Windows Settings\Security Settings\Local Policies\Security
Options\Accounts:Rename Administrator account

--
Dmitry Korolyov [[email protected]]
MVP: Windows Server - Active Directory


Could you also use this script to rename any local ADministrator account
back to "Administrator" ?
 
Back
Top