• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 488
  • Last Modified:

script to change local administrator passwords over network

Ok, I am tasked with changing over 600+ computer usernames and passwords.  

I plan on doing this over the network, probably using PsExec utility.  

but the script I want to send over the network needs to change the local administrator password.  I have the current username and password for all the computers.  

Lets assume that the username is "administrator" and password is "bang"...
what script (windows, or any other kind) would be able to remotely change the passwords?
0
icecom4
Asked:
icecom4
  • 9
  • 7
  • 4
1 Solution
 
edster9999Commented:
Are they really 95 / 98 clients (I'm asking as you put it in that zone) ?

Are they on a domain ?  If so you can do it with a group policy in minutes :
Example :
http://forums.techarena.in/active-directory/701089.htm
0
 
icecom4Author Commented:
They are all winxp and windows 7 computers "most" are on the domain.  I was hoping to use PsExec to single out only desktops, and leave the servers on the domain alone.   Would this script you linked work if run from the computer somehow or does it have to be run from AD?

0
 
edster9999Commented:
The update I was working on only works on computers in the domain - but it is very sucessful as it gets all pcs on next login.

I would run that on the domain and then set up a script to catch the rest
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
icecom4Author Commented:
I am still learning AD, would you have a link to a good tutorial on how to perform this task from within AD?  
0
 
ReneGeCommented:
Here is what I use.

This will change the local admin apssword of the PCs that their name starts by: \\PC-Admin- and \\PC-Sales-

Dont forget to customise this batch file by changing the name of how PCs starts, and the actual password.

Cheers,
Rene
@ECHO OFF

SETLOCAL enabledelayedexpansion

SET LogFile=%~dpn0.log
IF EXIST "%LogFile%" DEL "%LogFile%"

FOR /F %%a IN ('NET VIEW ^| FINDSTR -i "\\PC-Admin- \\PC-Sales-"') DO (
	ECHO RESETTING LOCAL ADMIN PASSWORD OF: %%a
	PSEXEC %%a NET USER Administrator NewPasswordHere
	ECHO !errorlevel! %%a>>"%LogFile%"
)

PAUSE
EXIT

Open in new window

0
 
ReneGeCommented:
Rephrased:

Dont forget to customise this batch file by changing how PC names starts, and replace NewPasswordHere by the new password you wish to set.

In the bath file, I am assuming that your local admin user name is Administrator.
0
 
icecom4Author Commented:
I will test this out on my home network first.  By "PC names starts" you mean hostname right??
0
 
ReneGeCommented:
netbios name; the name of the PC.
0
 
icecom4Author Commented:
edster9999 I tried using the group policy but I think it is disabled on our AD controllers.  

I will probably try the local script ReneGe is suggesting.  

I will get back yo you guys
0
 
icecom4Author Commented:
ReneGe, question, this script will be run using psexec.  Do I need the line to say what computers the script will run on?  psexec finds all the computers on the domain last I checked.  
0
 
edster9999Commented:
The FOR line looks for PCs using NET VIEW and then filters them down by the names in the script.
Each pc name is then passed to the commands inside the loop in the %%a bit
so that will change each time to be the next matched name
0
 
ReneGeCommented:
Yep!!

icecon4, try this. In a command prompt, type the followings (by changing "BegeningOfApcNameHere") and compair results (only one % is required at the command line, not batch file, where requires two):
@echo off & for /L %a in (1,1,100) do echo %a
@echo off & for /L %a in (1,1,100) do for /f %b in ('echo %a ^| findstr 7') do echo "%b"
net view
net view | findstr -i "\\BegeningOfApcNameHere"
@echo off & for /f "delims=" %a in ('net view') do echo "%a"
@echo off & for /f "delims=" %a in ('net view ^| findstr -i "\\BegeningOfApcNameHere" ') do echo "%a"
0
 
icecom4Author Commented:
I forgot to mention that I am using ezexecute.  So the script WILL get executed on each domain machine.  I just need the minimum to get this pw changed on all machines.  The username is administrator.  
0
 
icecom4Author Commented:
So in other words, I dont need anything in the script to find computers, I got that.
I will be using ezexecute to log on every machine via domain administrator, and force a batch script.  

I need a script that will change the local computer administrator password only.  
0
 
ReneGeCommented:
That was am important detail. Would have saved lots of time.

Here is your required command line:
NET USER Administrator NewPasswordHere
0
 
icecom4Author Commented:
Thanks for the command.  Actually I may end up needthing the full script that you suggested because I am not sure if Windows 7 will allow ez execute to transfer the script.  if not, I will try the ones posted above.  
0
 
ReneGeCommented:
Let me know things go.

Cheers,
Rene
0
 
icecom4Author Commented:
Thanks Ren, this worked on the workstations that ez execute didn't get
0
 
ReneGeCommented:
Glad I could help.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 9
  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now