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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems running scripts on multiple computers

Status
Not open for further replies.
Oct 10, 2003
90
US
Several scripts taken from Technet and other locations around the web seem to work just fine at home. Each example script is set to run against various machines using a text file. In the home location, I am running a simple Windows 2000 AD setup with 5 machines total on the network.

However, the same exact script will not work in my work enviroment. The only thing being altered in each script is the name of the text file used to supply the IP addresses of various machines. The error being returned is
Error: The remote server machine does not exist or is unavailable: 'GetObject'

However, I can modify each script to run successfully against a single machine at a time. Having to run a script against 800 computers would still save time versus goin to each PC, but I would still rather be able to run from a text file.

Where would I begin looking? Granted I am still extremely new to the scripting world, but I don't see this being an infrastructure problem nor an anti-virus software blocking me out. Any suggestions?
 
Hard question to answer, please post your code so that we can see if there are errors.

Thanks,

Z
 
This is one of the scripts that I am using.


On Error Resume Next
Const ForReading = 1
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("c:\scripts\so.txt", ForReading)
i = 0
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
objDictionary.Add i, strNextLine
i = i + 1
Loop
For Each objItem in objDictionary
StrComputer = objDictionary.Item(objItem)
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery("Associators of " _
& "{Win32_Service.Name='wuauserv'} Where " _
& "AssocClass=Win32_DependentService " & "Role=Antecedent" )
For each objService in colServiceList
objService.StopService()
Next
Wscript.Sleep 20000
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='wuauserv'")
For each objService in colServiceList
errReturn = objService.StopService()
Next
Next
msgbox "done"

Upon further review though, it seems that the script does work against computers in a workgroup. I change the text file and it has worked against every computer in a workgroup. The problem seems to be running against a group of computers in a domain.

I use the same local accounts on each machine and the same passwords. I can alter this script to run against one machine at a time and it works fine.

So I am thinking it has something to do with the credentials being used, but I am being thrown off because of the fact that the local accounts are identical.
 
You are on the right track the local accounts may seem identical, but they are really not. Example: If you have an account on CompA, CompB and CompC called Admin and has the same password it would appear that they are identical. But actually the credential is thus:

CompA\Admin
CompB\Admin
CompC\Admin

To remedy this why not try to put the Domains Admin group in the local admins group on each machine. This should alleviate the issue you are having and makes it easier to admin a network effectively. Also in the case of where I work the local admin accounts on machines are the same, but the passwords are different for each site. So we make sure that the local admins group has the Domain admins group add to be able to do things just like what you are doing.

Hope this wasn't confusing,

Z
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top