Welcome to ServerForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Set local admin password

 
   Windows Server (Home) -> Windows Server Scripting RSS
Next:  Adding provider  
Author Message
Mike

External


Since: Mar 20, 2006
Posts: 56



(Msg. 1) Posted: Wed Jun 14, 2006 12:35 pm
Post subject: Set local admin password
Archived from groups: microsoft>public>windows>server>scripting (more info?)

I would like to change all XP local admins password to the same on the
network. I have a list of computers in a text file that I would like to
point to and then return to a file if it was successful or not.

Anyone have any ideas?

Mike

 >> Stay informed about: Set local admin password 
Back to top
Login to vote
J Ford

External


Since: Jan 12, 2005
Posts: 54



(Msg. 2) Posted: Fri Jun 16, 2006 10:41 am
Post subject: RE: Set local admin password [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

this script will work, just modify it to loop through a text file and add
error handling to track successes and changes.

<script>
On Error Resume Next

Dim oWshNet, sComputerName, sLocalAdmin

' get computer name for local computer
Set oWshNet = CreateObject("WScript.Network")
sComputerName = oWshNet.ComputerName

' Get Local Administrator Name
sLocalAdmin = GetAdministratorName(sComputerName)

' Call sub
ChPW

Sub ChPW()

' connect to user object
Set oUser = GetObject("WinNT://" & sComputerName & "/" _
& sLocalAdmin & ",user")

' Change PW
oUser.SetPassword sNewPassword
oUser.SetInfo

End Sub

Function GetAdministratorName(sComputerName)
Dim sUserSID, oWshNetwork, oUserAccount

Set oUserAccounts = GetObject( _
"winmgmts:{impersonationLevel=impersonate}!//" _
& sComputerName & "/root/cimv2").ExecQuery( _
"Select Name, SID from Win32_UserAccount WHERE Domain = '" _
& sComputerName & "'")

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
</script>

"Mike" wrote:

> I would like to change all XP local admins password to the same on the
> network. I have a list of computers in a text file that I would like to
> point to and then return to a file if it was successful or not.
>
> Anyone have any ideas?
>
> Mike

 >> Stay informed about: Set local admin password 
Back to top
Login to vote
AndyK

External


Since: Sep 28, 2006
Posts: 4



(Msg. 3) Posted: Thu Sep 28, 2006 3:41 pm
Post subject: RE: Set local admin password [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

You can use a utility call CUSRMGR. It will do the trick.
It took me awhile to find the file, and I have recently acquired it. It
comes with the 2000 resource kit. If you cannot locate it, let me know and
I'll email it to you.

Andy

"Mike" wrote:

> I would like to change all XP local admins password to the same on the
> network. I have a list of computers in a text file that I would like to
> point to and then return to a file if it was successful or not.
>
> Anyone have any ideas?
>
> Mike
 >> Stay informed about: Set local admin password 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Local Admin Password - Hi How do I check to see if the local admin password is not set to blank

check local admin password - All, The local admin password on my network is consistant on each box. I am working on a program that will check custom configuration settings through out our domain. I need a way to verify the local admin password on each box. I want be able to..

Resetting Local Admin password - Hi I would like to be able to reset the local admin password in various remote file servers and workstations in the Enterprise. Could someone point me to a sample script to accomplish this? Any help will be appreciated -JPierre

Set Local Admin password script not working - Script from Microsoft's Script center is giving me errors when I run it on either an XP or W2K. I have tried modifying the code with no luck. Any suggestions on how to get this code to run? strComputer = "MyComputer" Set objUser =..

local admin password script error - I am trying to use the script in the scriptcenter: strComputer = "labcomp04" Set objUser = GetObject("WinNT://" & strComputer & "/Administrator,user") objUser.SetPassword "newpassword" objUser.SetInfo whe...
   Windows Server (Home) -> Windows Server Scripting All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]