Page 1 of 1 1
Topic Options
#144285 - 2005-07-26 11:09 AM need a script to change local administrator password for hundreds of users
nayef Offline
Lurker

Registered: 2005-07-26
Posts: 3
I have hundreds of machines (clients) on the domain and I need a script to change the local admin password on them.

also, I am using ScriptLogic and it only supports kix coding. Correct me if I am wrong please.

thanks in advance

Top
#144286 - 2005-07-26 11:16 AM Re: need a script to change local administrator password for hundreds of users
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Well, you could use the command line tool net for this.
This has come up several times last weeks. Please do a search and you'll find plenty examples.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#144287 - 2005-07-26 11:25 AM Re: need a script to change local administrator password for hundreds of users
nayef Offline
Lurker

Registered: 2005-07-26
Posts: 3
thanks for the fast reply Mart..

I already did a search but found nothing

Top
#144288 - 2005-07-26 04:00 PM Re: need a script to change local administrator password for hundreds of users
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, first thing to do is to pull the workstation names for the admin script to fire.
as you should not go and change such things in logonscript.
_________________________
!

download KiXnet

Top
#144289 - 2005-07-26 04:05 PM Re: need a script to change local administrator password for hundreds of users
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I posted an admin script here some time ago that uses Howard's RenameAdmin.exe utility to change the LUser Administrator password once a month. There are many others as well, I am sure. Try the board search.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#144290 - 2005-07-26 06:54 PM Re: need a script to change local administrator password for hundreds of users
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
A method like this will work, but only IF the local administrators account is in English and has not been rennamed. There are other methods or tools that you could use or shell out to even from ScriptLogic if the names have been renamed or are in other languages. The workstations.txt file needs to be in the same folder as the script and it basically has the name of each computer you want to change, one name per line. You MUST have Admin rights on the remote system. 


Sampel code, UNTESTED
 

Code:

Dim $Computers,$sComputer
$Computers=ReadFile(@ScriptDir+'\'+'workstations.txt')
For Each $sComputer In $Computers
If $sComputer
ChangePass($sComputer)
EndIf
Next
 

Function ChangePass($sComputer)
$objUser=GetObject("WinNT://" + $sComputer + "/Administrator, user")
$objUser.SetPassword("MyNew2:Pass")
$objUser.SetInfo
Exit @ERROR
EndFunction
 

Function ReadFile($file)
Dim $lf, $f, $_, $t
$lf=CHR(10)
$f=FreeFileHandle
$_=Open($f,$file)
If @ERROR Exit @ERROR EndIf
Do $t=$t+$lf+ReadLine($f) Until @ERROR
$_=Close($f)
$ReadFile=Split(SubStr($t,2),$lf)
EndFunction



 

Top
#144291 - 2005-07-26 07:22 PM Re: need a script to change local administrator password for hundreds of users
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The beauty of using Howard's RenameAdmin.exe utility is that it doesn't care if the account has been renamed or has a localized name. Also, my script runs as a scheduled task every 2 hours and should eventually catch all the computers that may not be always turned on.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#144292 - 2005-07-26 07:41 PM Re: need a script to change local administrator password for hundreds of users
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
You could also use Win32ADMIN.DLL to get the localized or renamed remote administrator account then set the password using ADSI.

http://home.comcast.net/~habullock/kix_solutions.htm


Edited by Howard Bullock (2005-07-26 07:42 PM)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#144293 - 2005-07-26 07:50 PM Re: need a script to change local administrator password for hundreds of us
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
you say that you are using scriptlogic. does not scriptlogic have a way to execute code with admin rights?

Bryce

Top
#144294 - 2005-07-27 01:36 AM Re: need a script to change local administrator password for hundreds of us
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Only the newer version does, the older versions did not have it. Even the new one might be sold as a "module" add-on.
 
I still like Howard util the best, but Lonkero just posted a UDF to get the SID so one could change that way in all script too.
 

Top
#144295 - 2005-08-04 09:49 AM Re: need a script to change local administrator password for hundreds of users
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
So nayef, did you try any of these solutions? How did it work out?
 

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 363 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.099 seconds in which 0.061 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org