简体   繁体   中英

WMI GetObject Permission Denied error

I've written a VBScript to connect a Win2k3 SP2 server to multiple Win2k3 + SP2 & WinXP + SP3 machines via WMI in order to query the systems Win32_OperatingSystem and Win32_ComputerSystem classes.

Set loWMISvc = GetObject("winmgmts:{impersonationLevel=impersonate,authenticationLevel=Pkt}\\" & lsStore & "\root\cimv2")

Note: 'lsStore' is the IP address of the computer system I successfully connection too prior. 

I then attempt to create a new object to the remote system where it keeps returning a permission denied error (output of script):

21/11/2011 1:17:50 PM     SUCCESS: Established connection to store
D:\Program Files\SUREfire Systems\Support\MG\QueryStores\QueryStores.vbs(244, 5) Microsoft VBScriptruntime error: Permission denied: 'GetObject'

Despite setting the objects ImpersonationLevel and AuthenticationLevel monikers as exepected, WMI also appears installed correctly on client and remote system. The initial connection to remote system is for the local administrator user also.

What else could be the cause the permission denied error that I'm not seeing? Any help would be appreciated.

I believe I've resolved my own query. A 'permission denied' error relates to the UAC so therefore you need to execute a script using the same level of access and permission as per the remote system. I simply ran a DOS command prompt running it as the admin user account on the client system and GetObject was successful.

Although an admin account would appear the same on two different systems, this proves you need to ensure the same level of access and security is adhered too ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM