Re: Permissions to execute the script




"AN" <an@xxxxxxxxxxxxx> wrote in message
news:uq$0Z5TLKHA.5992@xxxxxxxxxxxxxxxxxxxxxxx
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/scriptcenter/topics/help/wmi.mspx

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

http://www.microsoft.com/technet/scriptcenter/resources/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
--


.



Relevant Pages

  • Re: WMI VBSCRIPT error 0x80041001
    ... The following script runs fine on SBS2003 and Vista Business. ... fails with error code 0x80041001 on XP Pro 64-bit, ... After a quick glance the script looks OK, so WMI may be corrupt. ... winmgmt /clearadap ...
    (microsoft.public.scripting.vbscript)
  • Re: Find Default Network Card NIC
    ... the code is identical on the two machines. ... For information about WMI you can start from the Microsoft Script Center ... Where NetConnectionID '' ...
    (microsoft.public.scripting.vbscript)
  • Re: Find Default Network Card NIC
    ... the code is identical on the two machines. ... Where can I look up all this useful WMI stuff? ... For information about WMI you can start from the Microsoft Script Center ...
    (microsoft.public.scripting.vbscript)
  • Re: 80041021 error - GetObject stdRegProv
    ... On a very small number of machines I see this ... error code 80041021, with no further explanation. ... it references is the WMI GetObject where I grab the stdRegProv. ... But the script runs flawlessly on ...
    (microsoft.public.scripting.vbscript)
  • Re: Creating a session in windows to auth to remote machines
    ... machines because they're all in the same domain and I run the script ... username etc. with WMI. ...
    (comp.lang.python)

Loading