Jump to content

Change the LOCAL Administrator password from another computer?


Recommended Posts

Is this possible? Change the LOCAL admin password automatically? I know I can "manage" another computer, but to do this to 30+ computers would not be cool.

Is there any way I can run a script on my Active Directory workstations to change the local "administrator" passwords, add another account, disable accounts, etc.?

Link to comment
Share on other sites


You can try this one :

http://www.windowsitpro.com/Articles/Index...playTab=Article

It is a batch script and it needs some reskit apps but it is usable, and it can also change the admin's accountname from what i have seen. Mind you i have not used tis myself yet but it seems to me like a usable thing that with some extra scripting and schaduling can do regular password changes.

Link to comment
Share on other sites

Hi,

I don't Understand Automatic......But this is my way...... not 30+ but 1K++++

Again save as WhatEverYouLike.vbs and 2click..

Then you will see a COMPUTERS.txt File genarated "Automatically" put the computer name inside and 2 click.

You can challange the script to do automatic using counters,,and loops etc try... or let me know...

But don't forget the "ChangePwdComputers.log"

'********************************************************************
'*
'* File: ADMLpass.vbs
'* Created: September 2005
'* Version: 2k509.21
'*
'* ' Sample Script For Changing The Local Administrator Account Password.
'*
'* Main Function: To Change The Local Administrator Account Password.
'*
'* Syntax Computername
'*
'* Copyright (C) 2005 Nidheesh Nattiala
'*
'********************************************************************
' Description: This script will read in a list of computer account names
' from a file (created manually or by exporting a list from an
' OU/container using ADU&C). Each computer name must be the
' first item on each line of the file; anything after the
' computer name will be ignored. The script will attempt to
' change the local Administrator account password for each
' computer. Note: The first line of the input file is
' assumed to be a header line. By NNattiala
'-------------------------------------------------------------------------------

'-------------------------------------------------------------------------------
' Initialization - Declare variables
'-------------------------------------------------------------------------------

Dim fsoIn, fsoOut
Dim inFile, outFile
Dim arrComputerNames
Dim objUser
Dim strComputer
Dim newPassword
Dim ErrorOccurred
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const inFilename = "Computers.txt"
Const outFilename = "ChangePwdComputers.log"

'-------------------------------------------------------------------------------
' Main script
'-------------------------------------------------------------------------------
On Error Resume Next
ErrorOccurred = False

' Insert WARNING here...
Msgbox ("WARNING: This script will change the local administrator password for every " & _
"computer listed in COMPUTERS.TXT. If any services are running with the local " & _
"administrator credentials, those services must be updated, or they won't " & _
"start on the next boot. For this script to work, you must have administrative " & _
"privileges on all of the remote computers you are changing the password for.")

' Get new password
newPassword = Inputbox ("Please Enter The New Password For The Local Administrators: Take Care Created By NNattiala","Enter The New Password","N!dh55sh")

' Open the input file and skip the header line
Set fsoIn = CreateObject("scripting.filesystemobject")
Set inFile = fsoIn.OpenTextFile(inFilename, ForReading, True)
inFile.Skipline

' Open the log file (append mode) and timestamp the entry
Set fsoOut = CreateObject("scripting.filesystemobject")
Set outFile = fsoOut.OpenTextFile(outFilename, ForAppending, True)
outFile.writeline (Now & vbTab & "Starting script...")

While Not inFile.AtEndOfStream
arrComputerNames = Split(inFile.Readline, vbTab, -1, 1)
' arrComputerNames(0) contains the computer name
strComputer = arrComputerNames(0)

' Connect to the computer\administrator account
Set objUser = GetObject("WinNT://" & strComputer & "/Administrator, user")
If Err.Number <> 0 Then
outFile.writeline Now & vbTab & "Error connecting to " & strComputer & " --- " & Err.Description
Err.Clear
ErrorOccurred = True
Else
' Set the password for the account
objUser.SetPassword newPassword
objUser.SetInfo
If Err.Number <> 0 Then
outFile.writeline Now & vbTab & "Error setting password for " & strComputer & _
"\Administrator" & " --- " & Err.Description
Err.Clear
ErrorOccurred = True
Else
outFile.writeline (Now & vbTab & "Password set for " & strComputer & "\Administrator")
End If
End If
Wend

' Clean up the environment
outFile.writeline (Now & vbTab & "Ending script...")
inFile.close
outFile.close

If ErrorOccurred Then
msgbox "Script completed with errors. Please check the log file."
Else
MsgBox "Script completed successfully."
End If

Belive The Force....

Link to comment
Share on other sites

You can also use a batch script via a domain policy if your 30+ comp are in the same domain or do it via psexec for sysinternals (able to run a command on a remote comp).

Link to comment
Share on other sites

Hi,

I don't Understand Automatic......But this is my way...... not 30+ but 1K++++

Again save as WhatEverYouLike.vbs and 2click..

Then you will see a COMPUTERS.txt File genarated "Automatically" put the computer name inside and 2 click.

You can challange the script to do automatic using counters,,and loops etc try... or let me know...

But don't forget the "ChangePwdComputers.log"

*snip*

Cool, nice script, its a better way than the batch i found. I like the input of the computernames in the txt file that way you can use a selective export to change the pwd on.

Thanks for the script :thumbup great stuff.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...