Compartir a través de


Making Direct Connections

The following procedure describes how to use the Scripting API for WMI to establish a direct connection:

How to use the Scripting API for WMI to establish a direct connection

  1. Obtain an SWbemLocator object.
  2. Obtain an SWbemServices object using SWbemLocator.ConnectServer, specifying the target host's dedicated IP address as the Computername parameter.
  3. Use the methods of SWbemServices to obtain instances of Network Load Balancing provider classes. For more information see Obtaining Class Instances.

The following code snippet demonstrates this procedure. For a more detailed code example, see NLBScriptLib.vbs.

Set oLoc     = CreateObject("WbemScripting.SWbemLocator")
strDIP       = "172.16.102.43"
strNamespace = "root\MicrosoftNLB"
strUser      = "Administrator"
strPassword  = ""

Set oSvc     = oLoc.ConnectServer(strDIP,       _
                                  strNamespace, _
                                  strUser,      _
                                  strPassword)
oLoc.Security_.ImpersonationLevel = 3