Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Permissions to execute the script

Reply
 
Old 09-04-2009   #1 (permalink)
AN


 
 

Permissions to execute the script

Hi All,

I am using a vbscript to query the WMI classes. The script uses the
following line ...

Set objWMIService = GetObject("winmgmts:\\" & sComp & "\root\cimv2")

On some machines, this vbscript works fine but on some machines this script
failes giving the following error:

Permission Denied: GetObject
Code: 800A0046
Source: Microsoft VBScript runtime error

Looks like some issue due to some machine specific setting as the script
runs fine on some machines.

Any pointers to resolve this is highly appreciated!


Rgds
AN



My System SpecsSystem Spec
Old 09-04-2009   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: Permissions to execute the script


"AN" <an@xxxxxx> wrote in message
news:uq$0Z5TLKHA.5992@xxxxxx
Quote:

> Hi All,
>
> I am using a vbscript to query the WMI classes. The script uses the
> following line ...
>
> Set objWMIService = GetObject("winmgmts:\\" & sComp & "\root\cimv2")
>
> On some machines, this vbscript works fine but on some machines this
> script failes giving the following error:
>
> Permission Denied: GetObject
> Code: 800A0046
> Source: Microsoft VBScript runtime error
>
> Looks like some issue due to some machine specific setting as the script
> runs fine on some machines.
>
> Any pointers to resolve this is highly appreciated!
>
>
> Rgds
> AN
>
>
After research some time ago I found the following regarding connecting to
remote computers with WMI:

1. You cannot connect to computer running XP Home.
2. An NT computer cannot connect to OS later than W2k.
3. A W2k3 computer cannot connect to Win9x.
4. To connect to W2k Server SP4 you must set impersonation level to
Impersonate.
5. W2k computers must have SP2 to connect to XP or above.
6. W2k3 can only connect to Win9x and NT if credentials supplied.
7. To connect to XP or W2k3 you must set authentication level to Pkt.

I'm not sure when (or if) setting impersonationLevel and authenticationLevel
is required, but it can't hurt. For best results in all situations, I use
code similar to:

strComputer = "pc_name"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
& strComputer & "\root\cimv2")

WMI can also be blocked or corrupted. I have used the following links for
troubleshooting:

http://www.microsoft.com/technet/scr.../help/wmi.mspx

http://support.microsoft.com/kb/875605

http://www.microsoft.com/technet/scr...es/wmifaq.mspx

I found the following to enable WMI in the firewall:

netsh firewall set service remoteadmin enable

You can rebuild the WMI repository, if you have XP SP2, with the command:

rundll32 wbemupgd, UpgradeRepository

The following commands reinstall WMI in the registry:

winmgmt /clearadap
winmgmt /kill
winmgmt /unregserver
winmgmt /regserver
winmgmt /resyncperf

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 09-04-2009   #3 (permalink)
Richard Mueller [MVP]


 
 

Re: Permissions to execute the script


"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
message news:OOmH$sWLKHA.6016@xxxxxx
Quote:

>
> "AN" <an@xxxxxx> wrote in message
> news:uq$0Z5TLKHA.5992@xxxxxx
Quote:

>> Hi All,
>>
>> I am using a vbscript to query the WMI classes. The script uses the
>> following line ...
>>
>> Set objWMIService = GetObject("winmgmts:\\" & sComp & "\root\cimv2")
>>
>> On some machines, this vbscript works fine but on some machines this
>> script failes giving the following error:
>>
>> Permission Denied: GetObject
>> Code: 800A0046
>> Source: Microsoft VBScript runtime error
>>
>> Looks like some issue due to some machine specific setting as the script
>> runs fine on some machines.
>>
>> Any pointers to resolve this is highly appreciated!
>>
>>
>> Rgds
>> AN
>>
>>
>
I probably should mention if you think permissions are the problem, that in
general you need to be a member of the local administrators group on the
remote computer in order to retrieve information with WMI remotely. The
group "Domain Admins" is added to the local administrators group by default
when the computer is joined to the domain, so if you are member of that
group you should be fine. Otherwise, the restricted groups feature can be
used to add other domain groups to the local administrators group of all
computers.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 09-06-2009   #4 (permalink)
AN


 
 

Re: Permissions to execute the script

Thanks so much for taking the time to help!

I shall try with the authentication level to pkt; hope it works!

Rgds
AN


"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
message news:OxR0jQcLKHA.4376@xxxxxx
Quote:

>
> "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
> message news:OOmH$sWLKHA.6016@xxxxxx
Quote:

>>
>> "AN" <an@xxxxxx> wrote in message
>> news:uq$0Z5TLKHA.5992@xxxxxx
Quote:

>>> Hi All,
>>>
>>> I am using a vbscript to query the WMI classes. The script uses the
>>> following line ...
>>>
>>> Set objWMIService = GetObject("winmgmts:\\" & sComp & "\root\cimv2")
>>>
>>> On some machines, this vbscript works fine but on some machines this
>>> script failes giving the following error:
>>>
>>> Permission Denied: GetObject
>>> Code: 800A0046
>>> Source: Microsoft VBScript runtime error
>>>
>>> Looks like some issue due to some machine specific setting as the script
>>> runs fine on some machines.
>>>
>>> Any pointers to resolve this is highly appreciated!
>>>
>>>
>>> Rgds
>>> AN
>>>
>>>
>>
>
> I probably should mention if you think permissions are the problem, that
> in general you need to be a member of the local administrators group on
> the remote computer in order to retrieve information with WMI remotely.
> The group "Domain Admins" is added to the local administrators group by
> default when the computer is joined to the domain, so if you are member of
> that group you should be fine. Otherwise, the restricted groups feature
> can be used to add other domain groups to the local administrators group
> of all computers.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>

My System SpecsSystem Spec
Old 09-08-2009   #5 (permalink)
AN


 
 

Re: Permissions to execute the script

I tried your steps but still it does not work. Can you please let me know if
there is something else that i can try out?

TIA

AN


"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
message news:OxR0jQcLKHA.4376@xxxxxx
Quote:

>
> "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
> message news:OOmH$sWLKHA.6016@xxxxxx
Quote:

>>
>> "AN" <an@xxxxxx> wrote in message
>> news:uq$0Z5TLKHA.5992@xxxxxx
Quote:

>>> Hi All,
>>>
>>> I am using a vbscript to query the WMI classes. The script uses the
>>> following line ...
>>>
>>> Set objWMIService = GetObject("winmgmts:\\" & sComp & "\root\cimv2")
>>>
>>> On some machines, this vbscript works fine but on some machines this
>>> script failes giving the following error:
>>>
>>> Permission Denied: GetObject
>>> Code: 800A0046
>>> Source: Microsoft VBScript runtime error
>>>
>>> Looks like some issue due to some machine specific setting as the script
>>> runs fine on some machines.
>>>
>>> Any pointers to resolve this is highly appreciated!
>>>
>>>
>>> Rgds
>>> AN
>>>
>>>
>>
>
> I probably should mention if you think permissions are the problem, that
> in general you need to be a member of the local administrators group on
> the remote computer in order to retrieve information with WMI remotely.
> The group "Domain Admins" is added to the local administrators group by
> default when the computer is joined to the domain, so if you are member of
> that group you should be fine. Otherwise, the restricted groups feature
> can be used to add other domain groups to the local administrators group
> of all computers.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
powershell script to execute simultaneously instead of sequentially PowerShell
execute Exchange script from DOS - how to get result? PowerShell
Execute a powershell script from a webpage PowerShell
execute powershell script from commmand line PowerShell
AD LogOn Scripts Execute permissions Vista account administration


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46