Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy File and update admin password Non domain

Status
Not open for further replies.

Wazz

Technical User
Aug 12, 2002
209
GB
Hi,

I need some help please. I have installed approx 180 pc's which I need to update the admin password on and update a driver. The pc's are not on the corporate domain but are allocated addresses via dhcp so there host names do resolve.

I have grabbed off google several scripts that claim to change the administrator password, but they all fail. I can only assume this is because I have been running the scripts from my domain pc, targating non domain pc's... Do I have to (and how do I do this) provide credentials of the admin account on those non domain pc's?

Then, I need to update the audio drivers on each pc as a priority... is there a way to do this without copying the msi file to each pc first?

Many thanks!!!
Wazz
 
The most glaring issue here is that you are supporting 180 PCs in a workgroup. You have correctly identified the issue, though, that credentials are your problem.

I can think of a couple of ways to accomplish what you are attempting. The first is easiest, if all the administrator accounts on the machines have the same name and password.

Option 1 (All admin names and PWs are the same): Set the local administrator name and password to the same as is set on the PCs. Log into your PC with that account and execute the script you have against PCs you are changing.

Option 2 (Varied names and / or PWs): Use PSExec from SysInternals to execute arbitrary commands or scripts on the remote machines in question, with any credentials needed.

Those are the quickest and easiest ways I can think of.

Good Luck!


PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Thanks for the reply.
All the admin passwords are the same and will remain the same as each other... but it needs to be changed.
So, looking at your option 1 suggestion, would the script use the credentials of the account im logged on as to connect to other pc's or do I have to specify the account and password in the script?

Cheers!
 
Option 1 will use the credentials that you are currently logged on with.


PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Hi Wazz,

I was hoping you could let me know if you found a solution to your problem.

I need to change the local administrator password on several pcs as well. Running Windows XP

The username and password is the same on all computers. I would like to be able to change the password on the administrator account through out all of them.

Thanks
 
Hi Smokeboy,

Sorry for my late reply, I have been away for a few days.

The above did work for me. As long as I ran the script logged on as the same account on the target pcs all was good.

As for the actual script I used, if you search google there are loads of different ones where the script will read computer names from a file and some will report back whether it worked or not. A script which I know works is below. It works by reading host names from a text file called wslist.txt which needs to be in the same folder as the script. Change the admin password on line 54
adminPassword = "password"
to what ever you want and give it a go.
Hope this helps
Wazz

Option Explicit


On Error Resume Next
Const EVENT_SUCCESS = 0
Dim WSHShell, oFSO, oFailureReport, oSuccessReport, oTextStream, oAdminID, RemotePC, strComputerName
Dim adminPassword

Set WSHShell = CreateObject("Wscript.Shell")
Set oFSO=CreateObject("Scripting.FileSystemObject")

If Not oFSO.FolderExists("c:\scripts\lists") Then
oFSO.CreateFolder("c:\scripts")
oFSO.CreateFolder("c:\scripts\lists")
End If

If oFSO.FileExists("c:\scripts\lists\failed.txt") Then
oFSO.DeleteFile("c:\scripts\lists\failed.txt")
End If

If oFSO.FileExists("c:\scripts\lists\success.txt") Then
oFSO.DeleteFile("c:\scripts\lists\success.txt")
End If


set oFailureReport=oFSO.createtextfile("c:\scripts\lists\failed.txt")
set oSuccessReport=oFSO.createtextfile("c:\scripts\lists\success.txt")




'open the data file
Set oTextStream = oFSO.OpenTextFile("wslist.txt")

If Err Then
MsgBox vbTab & vbTab & "WSLIST.TXT Source File Required" & vbCrLf & "Create the file, place in the same directory as this script and try again."
WScript.Quit
End If

'make an array from the data file
RemotePC = Split(oTextStream.ReadAll, vbNewLine)
'close the data file
oTextStream.Close


For Each strComputername In RemotePC
'Goto the local Admin account of the machine
set oAdminID = GetObject("WinNT://" & strComputername & "/administrator,user")
'Check for error and record in case of failed attempt
If Err Then
ReportError()
Err.Clear
Else
adminPassword = "password"
oAdminID.SetPassword adminPassword
oAdminID.SetInfo
oSuccessReport.WriteLine strComputername & " Admin Password was reset."
End If
WSHShell.LogEvent EVENT_SUCCESS, _
"Admin password reset by a script from The Spider's Parlor. "\\" & strComputername
Next

'Close all open files
oFailureReport.close
oSuccessReport.close

'Let us know its finished
msgbox "Done"

set oFSO = nothing
set oAdminID = Nothing
set oTextStream = nothing
set oSuccessReport = nothing
set oFailureReport = nothing

Sub ReportError()
oFailureReport.WriteLine strComputername & " could not be reset. Check that it is powered on." & Err.Number
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top