Page 1 of 1

Object Required Error

Posted: Sat Jun 06, 2009 9:57 am
by funnysun
Hi Guys,

I'm reading Don Jones book VBScript, WMI, and ADSI unleashed

but I always get Object Required error string: XXXX on line 6 in following code

Object Required Error

Posted: Sat Jun 06, 2009 12:39 pm
by funnysun
thank you jvierra, you have been always very very nice and helpful here.
it's so great that this forum has you here.
:D

Object Required Error

Posted: Mon Jun 08, 2009 12:15 am
by rasimmer
Would this be the issue?

Set oSys=GetObject("wmimgts:{impersonateleve=impersonate}!//"& sComputer &"/root/civm2:"&_

vs.

winmgmts

Object Required Error

Posted: Mon Jun 08, 2009 2:13 am
by abqbill
Hi rasimmer,Most of the time,

Code: Select all

winmgmts:
will be the same as

Code: Select all

winmgmts:{impersonationlevel=impersonate}
because 'impersonate' is usually the default WMI impersonation level. In case 'impersonate' is not the default, explicitly specifying the impersonation level increases the code's robustness. It is not a bad idea to add it to your code on the outside chance someone has changed the default impersonation level on a machine.HTH,Bill

Object Required Error

Posted: Mon Jun 08, 2009 2:42 am
by abqbill
Hi rasimmer,Sorry -- I didn't read your post carefully.Bill

Object Required Error

Posted: Mon Jun 08, 2009 3:11 am
by jvierra
Three items:

1. Use no set in assigning named arguments to variables.
2. Misspelled "winmgmts"
3. Mispelled impersonationLevel

Good average for the number of code lines.

It tiook me a couple of years to learn how to spell "winmgmts" correctly too.


Object Required Error

Posted: Tue Jun 09, 2009 12:38 pm
by funnysun
sorry guys,wmimgts:{impersonateleve this was my typo
but thank you for pointing out :)