- WMI 1.5 or higher
- Windows 95, 98, 98SE, Millennium
- Windows NT 4.0, 2000, XP, 2003, Vista, 2008, 7
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.
The classfull connection line for using SWbemLocator is:
Set objWMIService = objSWbemLocator.ConnectServer(<computerName>, <wmiDefaultClassPath>, <username>, <password>)
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
But I’m using a workgroup!
Don’t worry, you can do one of three things.
- Prefix the remote machine name (the local logon domain)
- Prefix the workgroup
- Send a null logon domain
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.