Chris Stauffer at

You want me to do What?



Links to blogs i like


Update for Remote Control code posted Last week for SMS 2003

We found a small issue with the new code.

Apparently some of the laptops have wireless cards that are active (actively looking for a connection) and reporting an address of “”

When the query ("Select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=True") is run these machines report the wireless card as enabled so when the script does the loop it keeps the last Ipaddress in the array. This was causing the remote tool to fail because the last value was

I added an “if” statement that will only act upon addresses that are greater than “” this resolved the problem in testing.

I also added an “Exit Sub” to the “If” statement so it should stop looking as soon as it finds a IP Address, so if the machine has 2 nics with 2 addresses it should only try and connect to the first address that it comes to that is not “”

Here is the new code:


Sub Btnl_OnClick

On Error Resume Next

          Dim CompName,oWshShell

          CompName = trim(document.frmMain.txtValue.value)

          path = "\\{SMSServer}\remote$\remote.exe"

          If Len(Trim(CompName)) = 0 then

                    MsgBox "Please type a Machine Name.",,"SMS 2003 Remote Control"


                    Set oWshShell = CreateObject("WScript.Shell")

                    set IPConfigSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//"& CompName &"").ExecQuery("Select IPAddress, IPSubnet  from Win32_NetworkAdapterConfiguration where IPEnabled=True")

                    If Err.Number <> 0 Then

                    MsgBox "Machine Not Found on the network, Please check the name and try again.",48,"SMS 2003 Remote Control"



                              for Each IPConfig in IPConfigSet

                                        If Not IsNull(IPConfig.IPAddress)  Then

                                        For i=LBound(IPConfig.IPAddress) To UBound(IPConfig.IPAddress)

                                        StrIP= IPConfig.IPAddress(i)

If  StrIP > "" Then

                                        'MsgBox "Machine's IPAddress: " & StrIP ,48,"SMS 2003 Remote Control"

                                        'You will need To edit the following line To fit your environment.  SMSServer = Your SMS Server Name

                               path & " 2 " & StrIP & " \\{SMSServer}\",0,False

Exit Sub                                    

End If


                              End If


End If

          end If

End Sub


Let me know if anybody finds any additional issues.

Published Monday, December 29, 2008 11:29 AM by cstauffer


No Comments