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 “0.0.0.0”
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 0.0.0.0
I added an “if” statement that will only act upon addresses that are greater than “0.0.0.0” 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 “0.0.0.0”
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"
Else
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"
Err.Clear
Else
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 > "0.0.0.0" 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
oWshShell.run path & " 2 " & StrIP & " \\{SMSServer}\",0,False
Exit Sub
End If
Next
End If
Next
End If
end If
End Sub
*********************************
Let me know if anybody finds any additional issues.