MSFN Forum: Change the LOCAL Administrator password from another computer? - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Change the LOCAL Administrator password from another computer? I would like to run a script that would change the local Admin passwor Rate Topic: -----

#1 User is offline   realized 

  • Junior
  • Pip
  • Group: Members
  • Posts: 95
  • Joined: 04-August 05

Posted 24 May 2006 - 11:20 PM

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.?


#2 User is offline   Zartach 

  • Junior
  • Pip
  • Group: Members
  • Posts: 91
  • Joined: 24-January 06

Posted 25 May 2006 - 03:47 AM

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.

#3 User is offline   Interface 

  • Newbie
  • Group: Members
  • Posts: 46
  • Joined: 29-June 04

Posted 28 May 2006 - 04:26 AM

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....

#4 User is offline   XP_2600 

  • Member
  • PipPip
  • Group: Members
  • Posts: 197
  • Joined: 20-February 03

Posted 28 May 2006 - 06:44 AM

You can enable telnet in the other machines, and connect to them via telnet then you can use net user command.

#5 User is offline   allen2 

  • Not really Newbie
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,439
  • Joined: 13-January 06

Posted 28 May 2006 - 11:00 AM

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).

#6 User is offline   Zartach 

  • Junior
  • Pip
  • Group: Members
  • Posts: 91
  • Joined: 24-January 06

Posted 28 May 2006 - 01:43 PM

View PostInterface, on May 28 2006, 04:26 AM, said:

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.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy