"Ivan Abramov" <> wrote in message
news:1C198E78-C427-4F35-9C38-...
> Hello.
>
> I have the VB6 code:
>
> Dim objSWbemLocator As Object, objSWbemServices As Object,
> colNetworkAdapters As Object
> Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
> Set objWMIService = objSWbemLocator.ConnectServer(sComputer, , sUser,
> sPassword)
>
> While execution I get the 'Access denied' error in the last line.
> Everything is working well only in local computer.
> As soon as I try to connect to remote computer, the error appears.
> Computer name, user name and his password is correct.
> Computers are not in a domain but in LAN.
> What is incoorect?
> I need to read computers config info.
>
> Many thanks in advance.
The user name should be in the form <ComputerName>\<UserName>, where
<ComputerName> is the NetBIOS name of the computer and <UserName> is the
name of the local user. The user should be a member of the local
Administrators group (on the target computer).
Also, shouldn't you specify the namespace, such as:
Set objWMIService = objSWbemLocator.ConnectServer(sComputer, "root\cimv2" ,
sUser, sPassword)
--
Richard Mueller
MVP Directory Services
Hilltop Lab -
http://www.rlmueller.net
--