Chris Stauffer at myITForum.com

You want me to do What?

Fixing the Remote Control Ping button issue for Ron’s Web Tools for SCCM 2007

Here is the code to fix the web console issue in SCCM 2007 talked about in the previous blog

 

'************************
' Remote Control Button *
'************************

Sub Btnl_OnClick
'You will need to edit the following line to fit your environment.  SCCMServer = Your SCCM Server Name
    On error resume Next
    Dim CompName,oWshShell
    CompName = Trim(document.frmMain.txtValue.value)
    If len(Trim(CompName)) = 0 Then
                        MsgBox "Please type a Machine Name.",48,"SCCM 2007 Remote Control"
    Else

        Set oWshShell = CreateObject("WScript.Shell")
        set IPConfigSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//"& CompName &"").ExecQuery("select IPAddress 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)
                'MsgBox "Machine's IPAddress: " & StrIP

                Next
            End If
next

        Else   
            Set objSWbemServices = GetObject("winmgmts:\\" & CompName & "\root\cimv2")
            err.clear
            Set colSWbemObjectSet = objSWbemServices.ExecQuery("Select * FROM Win32_OperatingSystem")
            For Each objSWbemObject In colSWbemObjectSet
            StrOS= objSWbemObject.Version
            Next
        end If
    end If

    If StrOS = "5.0.2195" Then
        Set oWshShell = CreateObject("WScript.Shell")
        path = "\\{SCCMServername}\remote$\remote.exe"
        'You will need to edit the following line to fit your environment.  SMSServer = Your SMS Server Name
         oWshShell.run path & " 2 " & StrIP & " \\{SCCMServername}\",0,False
         Else
            Set oWshShell = CreateObject("WScript.Shell")
            path = "\\{SCCMServername}\remote$\rc.exe"
             oWshShell.run path & " 1 " & StrIP & " \\{SCCMServername}\"
            end If
End Sub

Published Friday, December 26, 2008 2:26 PM by cstauffer

Comments

# re: Fixing the Remote Control Ping button issue for Ron’s Web Tools for SCCM 2007@ Friday, December 26, 2008 9:33 PM

Nice!

# re: Fixing the Remote Control Ping button issue for Ron’s Web Tools for SCCM 2007@ Monday, December 29, 2008 12:41 PM

Updated Code to Fix an issue with this code

Follow link:

myitforum.com/.../update-for-remote-control-code-posted-last-week-for-sccm-2007.aspx