Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > WMI connect server error 'Access denied'

Reply
Thread Tools Display Modes

WMI connect server error 'Access denied'

 
 
Ivan Abramov
Guest
Posts: n/a

 
      09-29-2009
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.
 
Reply With Quote
 
 
 
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      09-29-2009

"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
--


 
Reply With Quote
 
Ivan Abramov
Guest
Posts: n/a

 
      09-30-2009
I changed the last line to:

Set objWMIService = objSWbemLocator.ConnectServer(sComputer, "root\cimv2",
sComputer & "\" & sUser, sPassword)

and tried with many remote computers. It's ok with Win2003Server only.
But with WinXP the result is the same: 'Access denied' error or 'The RPC
srver is unavailable' error (on two different comps).
I tried to turn on many services (concerned with WMI and not), but didn't
succeed.
What's wrong with WinXP?
I've been with this unsolved problem for half a year. Help, plz.

 
Reply With Quote
 
jford
Guest
Posts: n/a

 
      09-30-2009
What WMI property are you querying, and does the local account you are
specifying have the permissions to perform the query?

"Ivan Abramov" wrote:

> I changed the last line to:
>
> Set objWMIService = objSWbemLocator.ConnectServer(sComputer, "root\cimv2",
> sComputer & "\" & sUser, sPassword)
>
> and tried with many remote computers. It's ok with Win2003Server only.
> But with WinXP the result is the same: 'Access denied' error or 'The RPC
> srver is unavailable' error (on two different comps).
> I tried to turn on many services (concerned with WMI and not), but didn't
> succeed.
> What's wrong with WinXP?
> I've been with this unsolved problem for half a year. Help, plz.
>

 
Reply With Quote
 
Ivan Abramov
Guest
Posts: n/a

 
      09-30-2009

I'm using many of the WMI properties (conserning the computer's config) but
further.
Now I cannot accomplish the ConnectServer method (to use the WMI properties).
I tried both the adminstrator's account and remote user account (which is
also a member of the administrators group).
 
Reply With Quote
 
Ivan Abramov
Guest
Posts: n/a

 
      11-09-2009

What is wrong with WindowsXP indeed?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File server denied access by Domain Controller: Access is denied because of failure to authenticate Jim Windows Server 2 05-24-2007 04:16 AM
Re: Access Denied Error - Server Management Bill Peng [MSFT] Windows Small Business Server 0 02-02-2006 02:42 PM
Re: Group Policy Editor (GPInventory.exe) - Error: Could not connect / Access Denied Dave Nickason [SBS MVP] Windows Small Business Server 0 02-01-2006 02:29 AM
Re: Access Denied Error - Server Management Cliff Zhang [MSFT] Windows Small Business Server 0 01-30-2006 07:45 AM
Cannot connect to DNS Server Access Denied DemoDog DNS Server 3 09-22-2005 03:00 PM



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 47 48 49 50 51 52 53 54 55 56 57 58 59