Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Change local administrator password of each machine on startup to the one set in the script.

Hi,

Change local administrator password of each machine on startup to the one set in the script.
After the change update a Log file on the change status.

Regards
Sharath
Avatar of TheNautican
TheNautican

sure...user NET USER
http://support.microsoft.com/kb/149427
@ECHO OFF
SET LOGPATH=\\servername\serverfolder
SET LOGNAME=AdminUpdates.log
 
NET USER ADMINISTRATOR NewPassword
ECHO Changed Admin pass for %COMPUTERNAME% >> %LOGPATH%\%LOGNAME%
 
EXIT

Open in new window

Avatar of bsharath

ASKER

Thanks Even when password fails to be set the log shows successful

I get this when i give a complex password

The password does not meet the password policy requirements. Check the minimum p
assword length, password complexity and password history requirements.

More help is available by typing NET HELPMSG 2245.

'*IPTglobal9' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .

The password i am using to set is
ICT&*^IPTglobal9
are you on a domain? if so, add the /domain switch at the end. Also are you enclosing the password in quotes? You have a special character in there and I don't recall for sure, but I think it needs quotes.
Like this?

NET USER ADMINISTRATOR "Domain\NewPassword"
Try this
NET USER ADMINISTRATOR "ICT&*^IPTglobal9" /domain

Open in new window

I get this

The request will be processed at a domain controller for domain DevGroup.co.uk.

The command completed successfully.

Press any key to continue . . .

Does it reset the pass on the DC or local administrator
I think adding the /domain switch at the end actually changes the domain admin password no?

I had to do the same thing at one point, try this:
strComputer = "."
Set objUser = GetObject("WinNT://" & strComputer & "/Administrator")
objUser.SetPassword("ICT&*^IPTglobal9")
If Err.Number <> 0 Then
	WScript.Echo "Error: " & Err.Description
Else
	WScript.Echo "Changed Password on: " & strComputer
End If

Open in new window

I am sure it did change the domain admin password...
you should be able to run that vbscript above, just don't run it on a DC because there is no local admin for a DC and it will reset the domain admin account
Ya, I never use it in a domain environment so... not sure. That VBScript looks like it should be what you need. So, did you try the NET USER command with quotes?
NET USER ADMINISTRATOR "ICT&*^IPTglobal9"

Open in new window

SaLus
Script is fine can i get a log that saves the machinename_Date of the password reset into a UNC path

TheNautican
Can i get it with the UNC storing option for logs
ASKER CERTIFIED SOLUTION
Avatar of SaLus
SaLus

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial