Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


WMI Issue

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,63958
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> WMI Issue
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 WMI Issue - 9/1/2008 11:21:14 AM   
  Aracanth

 

Posts: 5
Score: 0
Joined: 8/31/2008
Status: offline
Hi Guys,
Can anyone help with a weird prob I am having. First the code:

Set objWMIServer = GetObject("WinMgmts:{ImpersonationLevel=Impersonate}!\\" & strServer & "\root\CIMV2")
   If Err.Number <> 0 Then
    Call subErrors
    Exit For
   End If
   Set objWMIRegistry = GetObject("WinMgmts:{ImpersonationLevel=Impersonate}!\\" & strServer & "\root\default:StdRegProv")
   If Err.Number <> 0 Then
    Call subErrors
    Exit For
   End If

Forget the "Exit For's" as this is within a For loop, but basically this works fine, and works reliably on nearly every server, apart from a few. I check with a WMI ping prior to attempting the WMI getobject too. What happens is that the server doesnt actually fail to respond or crash the script, (I have used the on error etc) but the script just seems to "wait" at the first getobject. It happens regularly with certain servers, and I just cant figure why. I CAN connect using WMI Browsers etc, and that seems fine, so I know perms are OK. Is there any way to force a WMI query to somehow "timeout" if the server is queried but doesnt answer?

Any thoughts?

Ara
 
 
Post #: 1
 
 RE: WMI Issue - 9/1/2008 11:22:09 PM   
  ninjamaster

 

Posts: 107
Score: 0
Joined: 1/23/2007
Status: offline
Have you tried clearing objWMIServer as it exits and loops round again? Just a thought?

set objWMIServer = None

(in reply to Aracanth)
 
 
Post #: 2
 
 RE: WMI Issue - 9/2/2008 2:37:40 AM   
  dm_4ever


Posts: 2669
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
You could try using swbemlocator...it only has two timeout (none and 2 min)...the following should be 2 min though if WMI is corrupted on the machine....it won't help either.


      

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Aracanth)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> WMI Issue Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts