PC Review


Reply
Thread Tools Rate Thread

changing administrator password

 
 
anonymous
Guest
Posts: n/a
 
      26th Jul 2004
Hi all,
I'm not sure if I should post this here or under group
policies for 2000 server.
My question is, Is there a way to mass change the
administrator password on all XP machines that are
connected to a 2000 server running active directory?
If the same password is used at setup then sometime down
the line that password may need to be changed on all the
machines.
Can this be done thru group policies or scripts?
Thanks in advance for any help
Sherry

 
Reply With Quote
 
 
 
 
Torgeir Bakken \(MVP\)
Guest
Posts: n/a
 
      27th Jul 2004
anonymous wrote:

> Hi all,
> I'm not sure if I should post this here or under group
> policies for 2000 server.
> My question is, Is there a way to mass change the
> administrator password on all XP machines that are
> connected to a 2000 server running active directory?
> If the same password is used at setup then sometime down
> the line that password may need to be changed on all the
> machines.
> Can this be done thru group policies or scripts?
> Thanks in advance for any help
> Sherry
>

Hi

You could do it in a computer startup script (with a GPO) that runs
as part of the boot up process (before the user logs in). It runs
under the system context and has admin rights.

To avoid users being able to read the script where the password is
stored, grant read access only for the AD group "Domain Computers"
to the script file.


As long as the Administrator account name is "Administrator", this
vbscript will set the password on the account:

'--------------------8<----------------------
sNewPassword = "testpassword"
Set oWshNet = CreateObject("WScript.Network")
sComputer = oWshNet.ComputerName

On Error Resume Next
Set oUser = GetObject("WinNT://" & sComputer & "/Administrator,user")
oUser.SetPassword sNewPassword
oUser.SetInfo
On Error Goto 0
'--------------------8<----------------------


If you want to change the password instead of setting it (but this
means you will need to be sure that you know the old password on
all the computers), use oUser.ChangePassword instead of
oUser.SetPassword, like this:

oUser.ChangePassword "old pwd here", sNewPassword



If there is a chance that the name of the administrator is not
"Administrator" (e.g. the account is renamed, or you have some
non-English OS versions), you could use this version instead:

'--------------------8<----------------------
sNewPassword = "testpassword"
Set oWshNet = CreateObject("WScript.Network")
sComputer = oWshNet.ComputerName
sAdminName = GetAdministratorName

On Error Resume Next
Set oUser = GetObject("WinNT://" & sComputer & "/" & sAdminName & ",user")
oUser.SetPassword sNewPassword
oUser.SetInfo
On Error Goto 0


Function GetAdministratorName()

Dim sUserSID, oWshNetwork, oUserAccount

Set oWshNetwork = CreateObject("WScript.Network")
Set oUserAccounts = GetObject( _
"winmgmts://" & oWshNetwork.UserDomain & "/root/cimv2") _
.ExecQuery("Select Name, SID from Win32_UserAccount" _
& " WHERE Domain = '" & oWshNetwork.ComputerName & "'")

On Error Resume Next
For Each oUserAccount In oUserAccounts
If Left(oUserAccount.SID, 9) = "S-1-5-21-" And _
Right(oUserAccount.SID, 4) = "-500" Then
GetAdministratorName = oUserAccount.Name
Exit For
End if
Next
End Function
'--------------------8<----------------------


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scr...r/default.mspx
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Administrator Password in XP Eric Windows XP Help 1 5th Jan 2005 06:27 PM
Changing password of Administrator Krygim Microsoft Windows 2000 Security 2 18th May 2004 04:10 PM
Changing Administrator Password Reid Microsoft Windows 2000 Security 1 12th May 2004 11:16 PM
changing administrator password max Microsoft Windows 2000 Active Directory 2 8th Apr 2004 09:25 PM
Changing Administrator Password David Aitchison Microsoft Windows 2000 0 1st Dec 2003 01:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:05 PM.