vb script gives wbem error 80041003

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
Hi Sjoerd,

Works fine here (tested under admin account).

MSDN says:
------
http://msdn.microsoft.com/library/d...us/wmisdk/wmi/swbemservices_associatorsof.asp
wbemErrAccessDenied
0x80041003
Current user does not have permission to view one or more of the classes returned by the call.
------

Perhaps posting this question in WMI/Scripting group will be a good idea.

--
Ramesh, Microsoft MVP
Windows XP Shell/User
http://windowsxp.mvps.org


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?
 
It works fine on almost any PC. To take it a bit further .... on the PC wich
has the problem now, it ran fine yesterday. However, I have no idea what
triggers this error and I have no ideas anymore where to start looking for
the solution. The only solution I have is a complete re-install.

By the way, I was looking for a WMI and scriptong forum, but could not find
it. Where is it?
 
Microsoft Public Newsgroups:
http://aumha.org/nntp.php

--
Ramesh, Microsoft MVP
Windows XP Shell/User
http://windowsxp.mvps.org


It works fine on almost any PC. To take it a bit further .... on the PC wich
has the problem now, it ran fine yesterday. However, I have no idea what
triggers this error and I have no ideas anymore where to start looking for
the solution. The only solution I have is a complete re-install.

By the way, I was looking for a WMI and scriptong forum, but could not find
it. Where is it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top