The Cause of Code 80041001

It's probably no consolation that this is a poorly documented error. Again, thanks to Mark he said that it was intermittent, and the same script worked fine on another server. Makes me suspect that one source of this problem is Active Directory synchronisation. Another cause of a Code 80041001 problem is that the underlying service has stopped, for example the spooler service. (Thanks to Robin Lee for this info).

The Solutions

Try running your VBScript on another machine? If this works, then your code is probably fine, it's more of a logical problem, or something up with the OS / Active Directory. I hate it when people say 'reboot the server', so try simply restarting the services that you are investigating.

One possibility is that your winmgmts service is corrupted if so, you have the following options. To be honest, I believe that there is only a 20% chance that these procedures will cure your 80041001 problem. A bonus is that you will learn or have a refresher on restarting services and registering services in the registry.

Start and Stop the winmgmts service
Navigate to the command prompt.

1) net stop winmgmt WBEM Directory 80041001

в командной строке, запущенной под Администратором

2) Using Windows Explorer, navigate to %systemroot%\system32\wbem directory and delete the Repository directory. By default, the repository folder is located in the C:\Windows\system32\wbem directory.

удалить/переименовать только поддиректорию


а не всю директорию


3) Switch to Command Prompt window, and type:
net start winmgmt

4) Re-Register the DLLs
The .DLL and .EXE files which WMI uses are located in %windir%\system32\wbem. This is how you re-register all the .DLL and .EXE files in the WBEM directory. To re-register the WMI components, run the following commands at the command prompt:

cd /d %windir%\system32\wbem
for %i in (*.dll) do RegSvr32 -s %i
for %i in (*.exe) do %i /RegServer