Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - WMI VBSCRIPT error 0x80041001

Reply
 
Old 11-10-2008   #1 (permalink)
Axel


 
 

WMI VBSCRIPT error 0x80041001

The following script runs fine on SBS2003 and Vista Business. The script fails with error code 0x80041001 on XP Pro 64-bit, leading me to believe the problem is either a 64-bit compatibilty issue, a corrupted WMI on the XP machine, or a VBScript implementation issue. All machines have the latest service packs and hotfixes installed.

--------------------------------------------------------------------------------

WScript.Echo "Using Win32_LogicalDisk object"
Set LDiskSet = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_LogicalDisk")
for each LDisk in LDiskSet
if LDisk.DriveType=3 then
WScript.Echo "-------------------------------------------------------------------------"
if isnull(LDisk.DeviceID) then
WScript.Echo "DeviceID is NULL"
else
WScript.Echo "DeviceID: " + LDisk.DeviceID
end if
if isnull(LDisk.Caption) then
WScript.Echo "Caption is NULL"
else
WScript.Echo " Caption : " + LDisk.Caption
end if
if isnull(LDisk.FileSystem) then
WScript.Echo "FileSystem is NULL"
else
WScript.Echo " FileSystem: " + LDisk.FileSystem
end if
if isnull(LDisk.Size) then
WScript.Echo "Size is NULL"
else
WScript.Echo " Size: " + formatnumber(LDisk.Size/(1024*1024),0) + " MB"
end if
if isnull(LDisk.VolumeName) then
WScript.Echo "VolumeName is NULL"
else
WScript.Echo " VolumeName : " + LDisk.VolumeName
end if
if isnull(LDisk.Name ) then
WScript.Echo "Name is NULL"
else
WScript.Echo " Name : " + LDisk.Name
end if

if isnull(LDisk.SystemName ) then
WScript.Echo "SystemName is NULL"
else
WScript.Echo " SystemName : " + LDisk.SystemName
end if
end if
Next

--------------------------------------------------------------------------------

Can you tell me how to fix the problem?

--
Axel Larson
..


My System SpecsSystem Spec
Old 11-10-2008   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: WMI VBSCRIPT error 0x80041001

Axel wrote:

The following script runs fine on SBS2003 and Vista Business. The script
fails with error code 0x80041001 on XP Pro 64-bit, leading me to believe
the problem is either a 64-bit compatibilty issue, a corrupted WMI on the XP
machine, or a VBScript implementation issue. All machines have the latest
service packs and hotfixes installed.

--------------------------------------------------------------------------------

WScript.Echo "Using Win32_LogicalDisk object"
Set LDiskSet =
GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_LogicalDisk")
for each LDisk in LDiskSet
if LDisk.DriveType=3 then
WScript.Echo
"-------------------------------------------------------------------------"
if isnull(LDisk.DeviceID) then
WScript.Echo "DeviceID is NULL"
else
WScript.Echo "DeviceID: " + LDisk.DeviceID
end if
if isnull(LDisk.Caption) then
WScript.Echo "Caption is NULL"
else
WScript.Echo " Caption : " + LDisk.Caption
end if
if isnull(LDisk.FileSystem) then
WScript.Echo "FileSystem is NULL"
else
WScript.Echo " FileSystem: " + LDisk.FileSystem
end if
if isnull(LDisk.Size) then
WScript.Echo "Size is NULL"
else
WScript.Echo " Size: " + formatnumber(LDisk.Size/(1024*1024),0) + " MB"
end if
if isnull(LDisk.VolumeName) then
WScript.Echo "VolumeName is NULL"
else
WScript.Echo " VolumeName : " + LDisk.VolumeName
end if
if isnull(LDisk.Name ) then
WScript.Echo "Name is NULL"
else
WScript.Echo " Name : " + LDisk.Name
end if

if isnull(LDisk.SystemName ) then
WScript.Echo "SystemName is NULL"
else
WScript.Echo " SystemName : " + LDisk.SystemName
end if
end if
Next

--------------------------------------------------------------------------------

Can you tell me how to fix the problem?

============
After a quick glance the script looks OK, so WMI may be corrupt. The
Win32_LogicalDisk class is supported by all OS's. What line (and statement)
raises the error? I have discovered the following:

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.

For best results in all situations, I use:

strComputer = "pc_name"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
& strComputer & "\root\cimv2")

For troubleshooting I use the following links:

http://www.microsoft.com/technet/scr.../help/wmi.mspx

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

http://www.microsoft.com/technet/scr...es/wmifaq.mspx

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


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Zip error using VBSCRIPT Error:Object not a collection VB Script
error CDO.Message - VBScript VB Script
vbscript.dll error VB Script
vbscript error Vista installation & setup
error 2738 vbscript Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46