Question : 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?
Code Snippet:
1:
2:
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
    Set objWMIService = objLocator.ConnectServer(strComputer, "root\cimv2", strDomain & "\" & stradministrator, strAdministratorPassword)

Answer : Connecting using for Windows Vista Machines

I could be mistaken, but I'm pretty sure I remember RPC dynamically allocating ports.  This is why I had suggested disabling windows firewall, not adding exceptions.

Again, nothing is wrong with the code, I've tested it on 2 independent domains across town.  If you want more help you'll have to post an error message.  Simply change your code to this:
1:
2:
3:
4:
Err.Clear
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objLocator.ConnectServer(strComputer, "root\cimv2", strDomain & "\" & stradministrator, strAdministratorPassword)
MsgBox "Error:" & vbCrLf & "Error number: " & Err.Number & vbCrLf & "Error description: " & Err.Description & vbCrLfI
Random Solutions  
 
programming4us programming4us