Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Other Programming > VBScript
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 19th, 2004, 08:09 AM
Authorized User
Join Date: Jul 2004
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default GetObject Trap

Set oReg=GetObject("winmgmts:{impersonationLevel=imper sonate}!\\" & _
            ComputerName & "\root\default:StdRegProv")

statement somehow traps itself and does not return any value (scrpit stops working - freezes).

There are few computers among 6000 comps in the corp. This is just cut-out of the script which is working fine untill this few computers are on (I think because of platform NT 4 which doesn not support automatition objects).

I'm asking: how to make somekind of thread or timer which runs independent from other script and skips the iteration when automatition object does not respond in timely fashion (let's say 10 sec).

I'm already pinging the computer and that works fine the problem is that I cannot get automatition object

Thanx in advance
Reply With Quote
  #2 (permalink)  
Old November 23rd, 2004, 08:37 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts


   As a test, why not try this:

Dim stError

On Error Resume Next

 Set oReg=GetObject("winmgmts:{impersonationLevel=imper sonate}!\\" & _
            ComputerName & "\root\default:StdRegProv")

stError = Err
WScript.Echo stError

On my Windows XP machine, I get this error returned:


If the rest of your code has error handling, or is running fine, then you can trap this value and do something like

If Err = -2147217375 Then ' or "If Err <> 0 Then"
   Set WshShell = WScript.CreateObject("WScript.Shell")
   WshShell.LogEvent 0, "MyScript.vbs: Error " & stError 'or some message
End If

if this value is returned. This posts a message to the Event Logs that tells you the script attempted to run, but this error was returned.

You could then put a routine at the beginning of the script that checks for this event log entry and either does something else or quits before it even gets to this point again.

You could also check the version of the OS in another routine at the beginning of the script and tailor the script for each OS version it detects, but this may cause the same sort of failure as above.

Reply With Quote
  #3 (permalink)  
Old November 24th, 2004, 02:39 AM
Authorized User
Join Date: Jul 2004
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts

the problem is that in runtime script just stops working and does not return any value. To solve the problem I would have to set a timer.

but thanx mmcdonal

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
GetObject jdhock8865 Visual Basic 2005 Basics 2 November 3rd, 2008 09:29 PM
getobject() failure- recent Loralee Access 2 November 24th, 2006 02:29 PM
getObject() and shell() question using automation juneBugz Access VBA 0 August 29th, 2005 08:46 PM
why GetObject with IIS is not working alyeng2000 ASP.NET 1.x and 2.0 Application Design 0 September 15th, 2004 09:00 AM
UCOMIRunningObjectTable.GetObject wstueve C# 0 December 18th, 2003 11:47 AM

All times are GMT -4. The time now is 10:56 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.