Link to home
Start Free TrialLog in
Avatar of mikedaves
mikedaves

asked on

Connecting using for Windows Vista Machines

In order to connect to xp pc's remotely, I changed the call  to the following code below from a winnmgts call.  It works all the time for XP on a remote pc.  However now my call will not work for a Windows Vista pc that is local to the application.  I am not sure whether the connectserver  method can make a local dcom call.  Obvisously the winnmgts did.  I want robust code that can connect to either Windows XP remotely or locally, Windows Vista remotely or locally and if possible Windows 7 locally and remotely.  Do I have to change the calls for each type.  What happens if I don't know the OS I am connecting to?  Can I use the connectserver method for all?  Is there a problem with the authentication type for Vista as opposed to XP?
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
    Set objWMIService = objLocator.ConnectServer(strComputer, "root\cimv2", strDomain & "\" & stradministrator, strAdministratorPassword)

Open in new window

Avatar of hpram99
hpram99
Flag of United States of America image

SWbemLocator. ConnectServer Method does support Connections with Vista, you may want to check if Vista is requiring the connection to support NLA.

See this link for more information on disabling NLA:
http://rextang.net/blogs/work/archive/2007/03/28/4773.aspx
Avatar of mikedaves
mikedaves

ASKER

NLA is turned off on the vista computer.  Second setting is selected, allow all computer to support remote desktop connections.  Third setting requiring NLA is not selected.
hmm... I just tested it and it worked fine from here.  Can you post more of your script?  What error are you getting?
I turn error off so I can't tell you the error number.  Error.Number in my script does not display in visual basic access when you breakpoint it at the error detection.  How do you list the error code?
I tested this from a Server 2008 to a Vista client. I got an RPC not responding error, but that was simply because windows firewall was on.

A couple things.

1. Default Vista Services will have RPC Locater turned off, start that service.
2. Vista Firewall will block RPC connections, turn it off.

try again.

There's nothing wrong with your 2 lines of code, it should work fine with vista & 7.
RPC Locator was turned off, turned it on.  Inbound rules for RPC Distributed Traffic Coordinator for private allows and was enabled.  RPC DTC for domain was disabled.  enabled it.  Tested and failed.
Turned off firewall and tested it and again failed.  DTC for private networks on outbound rules was enabled. Enabled DTC for  outbound rules for domain traffic and tested and again failed.  Also on exceptions tab for firewall properties in security center, added tcp ports 115 and 135 and tested and failed.
What about authentication level for vista.  I read something that XP must have pkt???  Could that cause it?  is there an authentication level parameter for wbemlocator and is it different for vista?  Just brainstorming here.  Quite frustrating not to solve it.
ASKER CERTIFIED SOLUTION
Avatar of hpram99
hpram99
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
added your msgbox , error number - 2147217308  error description - user credentials can not be used for local connections.  I guess that says it all.  it is a local connection. .  When I  changed the call to Set objWMIService = objLocator.ConnectServer(strComputer, "root\cimv2") it worked.  Is there anyway to tell if it is a network connection vs a local connection?
pretty sure it's telling you that you can't remote into the same PC the script is running on.  Local = the computer the script is running on.  Remote = anything else.
I guess I could try it both ways and put messages in my log to indicate a local connection vs a remote connection
I will put the additional code to try it both ways.  This way I can log the type of connection and debug when I role out the application.  Thanks for your help
Expert Very Knowledgeable and used test cases that completely verified code