G
Guest
Hi,
When I run a script to test wether a PC is a laptop or a notebook I get
error 80041003. This is WbemErrAccessDenied. The strange thing is that my
script runs fine on almost any PC.
This is the script:
Set InfoNT = CreateObject("WinNTSystemInfo")
strComputer = InfoNT.ComputerName
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colChassis = objWMIService.ExecQuery("SELECT * FROM
Win32_SystemEnclosure")
For Each objChassis in colChassis
For Each intType in objChassis.ChassisTypes
MsgBox intType
Next
Next
I hav edoen some testing.... when I leave out the impersonationlevel, I get
error 8004100e, which is WbemInvalidNameSpace. When i also omit the namespace
(root\cimv2), it changes to 80041002 WbemErrNotFound.
Has anyone any idea how to fix this?
When I run a script to test wether a PC is a laptop or a notebook I get
error 80041003. This is WbemErrAccessDenied. The strange thing is that my
script runs fine on almost any PC.
This is the script:
Set InfoNT = CreateObject("WinNTSystemInfo")
strComputer = InfoNT.ComputerName
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colChassis = objWMIService.ExecQuery("SELECT * FROM
Win32_SystemEnclosure")
For Each objChassis in colChassis
For Each intType in objChassis.ChassisTypes
MsgBox intType
Next
Next
I hav edoen some testing.... when I leave out the impersonationlevel, I get
error 8004100e, which is WbemInvalidNameSpace. When i also omit the namespace
(root\cimv2), it changes to 80041002 WbemErrNotFound.
Has anyone any idea how to fix this?