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!

Help regarding GetObject function

Status
Not open for further replies.

kmkeshav

IS-IT--Management
Dec 12, 2005
273
NL
Hi All,

I have written a VBScript to check for the status of a service and output to a text file. This script will run againt a list of servers. When I tested the script, I found it hangs in the below line:

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

This is happening when running against a Windows 2000 Advanced Server. On other Windows Server 2003 machines it runs successfully.

Please suggest.
 
+ the context in which the script is running, does it have rights to the server?

+ is WMI available on the target device?

+ what other checks have you done to see if the device is actually available by machine name resolution, ping etc?
 
Thanks for the response. Here are the answers:

1. I have domain admin rights for all the computers in context.

2. Operating System on the server having problem is Windows 2000 Advanced Server with SP4 and checked for the WMI service running on the server. Please let me know for the other methods to check for WMI enabled on a server.

3. I could ping the server by name from the server on which I am running the script.
 
One more point.....

I have code included in the script that will ping the servers before it executes the line in question. The ping codes executes well tells me the server is up and running. So there should be any problem with name resolution I suppose.

Thanks.
 
*****there shouldn't be any problem with name resolution I suppose*****
 
for testing purposes you can try and run the script directly on the server which is giving you problems, this should flush out if it is an issue with DCOM/permissions/connectivity
 
? no luck, i.e. the script doesnt work when you are running it on the target box?

if thats the case then where is the rest of the script and do you get an distinct error messages?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top