Error 0x80070005 when using SWbemLocator.ConnectServer to initiate a WMI session despite using the correct username and password

System Requirements:

  • WMI 1.5 or higher
  • Windows 95, 98, 98SE, Millennium
  • Windows NT 4.0, 2000, XP, 2003, Vista, 2008, 7

The Problem:

When using WMI’s SWbemLocator.ConnectServer class to log onto a remote system, you receive an 0x80070005 access denied error (Decimal -2147024891).

This error occurs even though the username and password are correct and the account credentials are synchronised properly between the local and remote machine – either by domain or manually in a workgroup.

More Info

The classfull connection line for using SWbemLocator is:

Set objWMIService = objSWbemLocator.ConnectServer(<computerName>, <wmiDefaultClassPath>, <username>, <password>)

for example:

Set objWMIService = objSWbemLocator.ConnectServer("192.168.0.100", "root\cimv2", "Administrator", "12345abcde")

The Fix

There is a very good chance that the problem you are having is to do with the username you are entering. You need to ensure that you are prefixing the username with the logon domain.

For example if your domain is camie.local your username should be camie\Administrator

Set objWMIService = objSWbemLocator.ConnectServer("192.168.0.100", "root\cimv2", "camie\Administrator", "12345abcde")

But I’m using a workgroup!

Don’t worry, you can do one of three things.

  1. Prefix the remote machine name (the local logon domain)
  2. Prefix the workgroup
  3. Send a null logon domain
Set objWMIService = objSWbemLocator.ConnectServer("192.168.0.100", "root\cimv2", "myHostName\Administrator", "12345abcde")

Set objWMIService = objSWbemLocator.ConnectServer("192.168.0.100", "root\cimv2", "workgroup\Administrator", "12345abcde")

Set objWMIService = objSWbemLocator.ConnectServer("192.168.0.100", "root\cimv2", "\Administrator", "12345abcde")

Using one of the above, you should be able to connect to the remote workstation. If you are dealing with a mix of workgroups or cannot know the hostname in advance I suggest using \<username> with I have tested to work on Windows 95 right through to Windows 7.

How to Enable Web Based Enterprise Management (WBEM) / Windows Management Instrumentation (WMI) for Remote Access under Windows 95, 98/98SE

System Requirements:

  • Windows 95
  • Windows 98
  • Windows 98 SE

The Problem:

This document outlines the steps required to connect to a Windows 98 or Windows 98 SE machine using WMI using either a Monkier (inherited session credentials) or SWbemLocator.ConnectServer (specific, stated logon credentials).

This is often difficult to achieve, especially in a domain environment or an environment where more modern versions of Windows need access to the remote WMI service.

More Info

Windows 95 and 98 First Edition (FE) do not ship with WBEM installed. Before you can access WMI in any form on these systems you must manually install the necessary services and resource files. This guide will show you how to properly install WMI in order to facilitate remote access connections over a Network. Please note that while this will enable WMI requests over a LAN, the settings will not discriminate between a LAN and an Internet connection. Consequently firewall technology should be employed when dealing with systems that expose a direct peer-to-peer Internet connection.

A Note on Windows 98 SE

While Windows 98 FE does not come with any WBEM components, Windows 98 SE does. The Windows 98 SE CD contains WBEM 1.10 components which can be installed from the Control Panel.

Windows 98 SE WBEM 1.10

It is important that you not use this version of WBEM on Windows 98 SE in order to connect remotely to the WMI service. This version of WMI is out of date (with the latest version being WBEM 1.5). Consequently if you are using Windows 98 SE, ensure that you have uninstalled ‘Web-Based Enterprise Mgmt’ from the Control Panel before following the guide below.

More Info: WMI on computers running Windows 98, 98SE and Windows Millennium Edition

The Fix

The steps below will enable you to connect remotely over WMI under some circumstances (but not all). These steps must be applied to install WMI and configure it before you can change the advanced remote connection settings.

Install DCOM 1.3 and do not reboot after the installation
DCOM 1.3 Installer

Install WMI 1.5 for Windows 9x
Run the WMICore 1.5 Installer

WMI Installer (1)

WMI Installer (2)

WMI Installer (3)

When prompted, reboot the computer

Unlike the Windows NT installation of WMI, the WMI 1.5 installer does not include the rather useful DCOMCnfg.exe utility that is required for GUI configuration of WMI for remote access. Thankfully the DComConfig utility was made available separately for Windows 9x.
DCOM Config Installer

Configure DCOM

To configure DCOM run the DCOMCnfg utility found in c:\windows\system

DComCfg Utility Launch

By default the “Enable Distributed COM on this computer” check box on the Default Properties tab should be ticked. Often if WMI isn’t working, this has inexplicably become unchecked, disabling DCOM completely.

DcomCnfg Screen 1

This will enable WMI to run on the local computer, but not from remote network connections. To enable the basic level of remote access check the “Enable remote connection” box on the Default Security tab. If this doesn’t work for you, keep reading!

DcomCnfg Screen 2

Restart the computer at this point.

It is important to understand that unlike with Windows NT, Windows 9x doesn’t have the concept of a special system service. Consequently DCOM won’t start WMI when it is requested from the network. In order to enable on-demand access the WinMgmt.exe program in c:\windows\system\wbem needs to be running.

WinMgmt

This dos prompt command will run the process for the duration of the session. You can always confirm that it is running by pressing Ctrl + Alt + Del once and viewing the task manager

WinMgmt Process in Ctrl + Alt + Del Screen

If you want to persistently run WinMgmt.exe as a ‘Service’ add the following information to the registry as shown.

Setup WinMgmt as a start service

Advanced Remote Access Settings

The above settings should work between NTLM enabled Windows 9x boxes and NT 4 systems, however you may have problems if the Active Directory extensions are installed or if you are attempting to connect from a Windows 2000, XP, 2003, Vista, 2008 or 7 machine.

Connection difficulties seem particularly true if you are using SWbemLocator.ConnectServer or are in any way connecting via IIS.

Do appreciate that this guide isn’t covering more basic things like “synchronise your accounts and passwords” between workgroup systems, ensure that you have IE 6.0 SP1 installed or that you have Windows Scripting Host 5.6 installed and so on.

First off, re-register the WinMgmt stack using the following command in the c:\windows\system folder

RegSvr Command for WMI

WBEM ships with an additional configuration utility, the WBEM Control app, found in c:\windows\system\wbem\

wbemcntl.exe

On the advanced tab enable the “Enable Anonymous Connection with share level security” setting and restart the computer.

Enable Anonymous Share Access

This setting allows WMI to respond to network requests that do not carry the required account credentials registered as having access to the WMI class hierarchy.

If you are now able to connect using SWbemLocator.ConnectServer you may like to try to reconfigure WMI to use WMICntl to assign permissions to WMI. To do that simply use the Security tab and, selecting Root, press the Security button and add in the user accounts that you want to gain remote access with to the security permissions list.

WMI Control Security

All being well, you should now have a working Windows 98 machine which supports Remote WMI from modern Windows systems.

If you would like to enable all of these settings without launching their respective utilities, you can use this registry script to automatically configure workstations with the remote access settings.

REGEDIT4

[HKEY_LOCAL_MACHINE\Software\Microsoft\OLE]
“EnableDCOM”=”Y”
“EnableRemoteConnect”=”Y”

[HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM\CIMOM]
“EnableAnonConnections”=”1”
“EnableStartupHeapPreallocation”=dword:00000000

[HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM\Scripting]
“Enable for ASP”=dword:00000000

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices]
“WinMgmt”=”C:\\Windows\\System\\WBem\\WinMgmt.exe”

See Also

View: How to Enable Web Based Enterprise Management (WBEM) / Windows Management Instrumentation (WMI) for Remote Access under Windows NT 4.0

View: How to Enable Web Based Enterprise Management (WBEM) / Windows Management Instrumentation (WMI) for Remote Access under Windows Millennium Edition

Microsoft Paint Update

There is an update for Windows NT 4.0 and Windows 95 which updates Paint to the Windows 98 version.

The patch is designed to correct incompatibilities between Microsoft Office 97 and the original 32-bit version of Paint.

System Requirements:

  • Windows 95, A, B, C
  • Windows NT 4.0 Workstation, SP1, SP2, SP3, SP4, SP5, SP6, SP6a
  • Windows NT 4.0 Server, SP1, SP2, SP3, SP4, SP5, SP6, SP6a
  • Windows NT 4.0 Terminal Server, SP1, SP2, SP3, SP4, SP5

The update will fix incompatibilities in:

  • Microsoft Office 97, SP1, SP2
  • Microsoft Office 2000, SP1, SP2
  • Microsoft Office 2002 (XP), SP1

The Problem:

There is a incompatibility between Paint and Office 97’s Graphics Import filters. If you try and open a non .BMP or .PCX image in Paint you will recieve the following error:

This program has performed an illegal operation and will be shut down.
If the problem persists, contact the program vendor.

If you click Details, you receive an error message similar to the Following message:

MSPAINT caused an invalid page fault in module MSPAINT.EXE at
0137:0042d3fe.

Patch Installation:

Windows 95 FAT or FAT 32:

  1. Download the Paint95.exe file from Q162500.
  2. Double-click the file you downloaded in step 1 to expand it.
  3. Copy the Mspaint.exe file to the Program Files\Accessories folder.
  4. Copy the three .dll files to the Windows\System folder.
  5. Restart your computer.

Windows NT 4.0 FAT:

  1. Download Paintnt.exe from Q162500.
  2. Double-click the file you downloaded in step 1 to expand it.
  3. Copy the .exe and .dll files to the Winnt\System32 folder.
  4. You will not be able to copy the Msvcrt.dll file while you are in a Windows NT session. Boot your computer from a MS-DOS boot disk and then copy the file.
  5. Restart your computer.
  6. Re-apply the latest service pack.

Windows NT 4.0 NTFS:

  1. Download Paintnt.exe from Q162500.
  2. Download the InUse utility from here
  3. Double-click the file you downloaded in step 1 to expand it.
  4. Copy the .exe and .dll files to the Winnt\System32 folder.
  5. You will not be able to copy the Msvcrt.dll file while you are in a Windows NT session. Open a command prompt and browse to the InUse.exe’s folder.
  6. Type inuse.exe Drive:\Location\msvcrt.dll Drive:\Winnt\System32\msvcrt.dll
    Where Drive is the drive letter which the new msvcrt.dll presides (e.g. C:) and Location is the directory which the msvcrt.dll file is found (e.g. \temp).
    e.g. inuse.exe c:\temp c:\winnt\system32\msvcrt.dll
  7. Restart your computer. The file will be unloaded from Memory, and on restart will be replaced before it is re-loaded into the Page File.
  8. Re-apply the latest service pack.

What changes:

Paint will be updated to the Windows 98 version. This includes the compatibility fixes as well as some minor program improvments.

There is a bug in the update which causes problems when maximiing the window. The bug will not effect system stability or the performance of Paint, and is an aestetic error only.

The patch will also update the Icon that Paint uses to the Windows 98 version.