Object Required Error

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
funnysun
Posts: 15
Joined: Wed Apr 08, 2009 7:16 pm

Object Required Error

Post 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

User avatar
funnysun
Posts: 15
Joined: Wed Apr 08, 2009 7:16 pm

Object Required Error

Post 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

User avatar
rasimmer
Posts: 182
Joined: Fri Jan 30, 2009 12:37 am

Object Required Error

Post by rasimmer »

Would this be the issue?

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

vs.

winmgmts

User avatar
abqbill
Posts: 138
Joined: Sat Apr 21, 2007 5:59 am

Object Required Error

Post 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

User avatar
abqbill
Posts: 138
Joined: Sat Apr 21, 2007 5:59 am

Object Required Error

Post by abqbill »

Hi rasimmer,Sorry -- I didn't read your post carefully.Bill

jvierra
Posts: 14543
Joined: Tue May 22, 2007 9:57 am
Contact:

Object Required Error

Post 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.


User avatar
funnysun
Posts: 15
Joined: Wed Apr 08, 2009 7:16 pm

Object Required Error

Post by funnysun »

sorry guys,wmimgts:{impersonateleve this was my typo
but thank you for pointing out :)

Locked