Re: Permissions to execute the script
- From: "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 4 Sep 2009 09:23:14 -0500
"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
--
.
- Follow-Ups:
- Re: Permissions to execute the script
- From: Richard Mueller [MVP]
- Re: Permissions to execute the script
- References:
- Permissions to execute the script
- From: AN
- Permissions to execute the script
- Prev by Date: Permissions to execute the script
- Next by Date: Re: problem download HTML in VBScript
- Previous by thread: Permissions to execute the script
- Next by thread: Re: Permissions to execute the script
- Index(es):
Relevant Pages
|
Loading