CA Service Management

 View Only
  • 1.  SA Task Editor, Auto Launch SCCM with Defined PC

    Posted Feb 27, 2018 06:36 PM

    Hey all,


    I'm attempting to create a new VBSCRIPT within the SA Task Editor for Support Automation.


    I have the following script to obtain the computer name (and individually it works):

    Function Execute()
    End Function

    Sub AddBasicSystemInfo
    Dim OSObj, CSObj, tmp
    Set OSObj = WMIObjects.GetOperatingSystemObject()
    Set CSObj = WMIObjects.GetComputerSystemObject()
    Set objNetwork = CreateObject("Wscript.Network")

    AppendDataItem "basicData", "", CSObj.Name, True
    End Sub

    Sub AppendDataItem(dataStoreName, name, value, logit)
    Dim strToAppend, origValue
    strToAppend = name & "||" & value & "^^"

    origValue = Task.GetNamedDataItem(dataStoreName)
    If IsNull(origValue) Then
    origValue = ""
    End If

    Task.SetNamedDataItem dataStoreName, origValue & strToAppend

    If logit = True Then
    WScript.Echo name & "" & value
    End If
    End Sub

    I have the following script to launch SCCM and it works on the PC itself:

    Option Explicit 

    Dim bPrompt, s32bitCCMViewerEXE, s64bitCCMViewerEXE, sErrMsg, WshShell
    Dim CCMViewerEXE, sSiteCode, sServer, objShell, sComputer
    Dim objArgs, objFile, objFS

    s64bitCCMViewerEXE = "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\i386\CmRcViewer.exe"
    s32bitCCMViewerEXE = "C:\Program Files\Microsoft Configuration Manager\AdminConsole\bin\i386\CmRcViewer.exe"

    'If we can't find an instances of the CmRcViewer.exe somewhere in our
    ' defined paths, then quit.
    If CheckEXE(s32bitCCMViewerEXE) = false and CheckEXE(s64bitCCMViewerEXE) = false then
    sErrMsg = "Could not find the SCCM remote command exe (CmRcViewer.exe). Please install the SCCM Administrator Console."
    msgbox sErrMsg,48,"Could not find CmRcViewer.exe"
    End If

    Set WshShell = CreateObject("WScript.Shell")
    'Get our command-line argument
    Set objArgs = WScript.Arguments

    If objArgs.count = 0 then

    On Error Resume Next
    sSiteCode = "INSERTSITECODE"

    'If there is only one argument, we'll assume it
    ' is for the host you are trying to connect to
    sComputer = objArgs(0)
    End if

    'If ping fails, then say so and exit the script.
    If PingHost(sComputer) = false then
    msgbox sComputer & " is not responding to pings. Aborting.",64,"Cannot communicate with host."
    'If ping succeeds, then move on.
    Else chr(34) & CCMViewerEXE & chr(34) & " " & sComputer & " \\" & sSiteCode ,1,false
    End If

    'Function to ping a computer name, returns 'true' or 'false.'
    Function PingHost(sComputer)

    Dim objExecResults, sResults

    Set WshShell = CreateObject("WScript.Shell")
    Set objExecResults = WshShell.Exec("ping.exe -n 1 " & sComputer)

    sResults = objExecResults.StdOut.ReadAll

    If instr(sResults, "Bad IP address") > 0 then
    PingHost = false
    End if

    If instr(sResults, "Reply from") > 0 then
    PingHost = true
    End if
    End Function 'Pinghost

    Function CheckEXE(sFile)
    On Error Resume Next
    Set objFS = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFS.getFile(sFile)

    If err.number <> 0 then
    CheckEXE = false
    CCMViewerEXE = sFile
    CheckEXE = sFile
    End if
    Set objFile = nothing

    On error goto 0
    End Function


    The problem is that I'm having issues combining them. Using the task editor. Do you know how or if it is possible to take the computer name returned from TASK1 and pass it to TASK2, to launch SCCM with the computer name.


    We are trying to avoid using the OOTB remote control software. The VBSCRIPT shown in TASK2 does not work within the task editor. Although it does work perfectly when ran on the PC.





  • 2.  Re: SA Task Editor, Auto Launch SCCM with Defined PC

    Broadcom Employee
    Posted Feb 28, 2018 01:17 PM

    Hey Jordan,


    Based on what we have found out so far, we don't think its possible to feed output from one as input to another. 



  • 3.  Re: SA Task Editor, Auto Launch SCCM with Defined PC

    Posted Feb 28, 2018 07:11 PM

    Thanks Raghu. Appreciate you doing some initial review.


    Is it possible through task editor to call and launch a file or application on the analysts machine? Or is the response confined to the analyst GUI window and what can be presented there?



  • 4.  Re: SA Task Editor, Auto Launch SCCM with Defined PC

    Broadcom Employee
    Posted Mar 02, 2018 04:48 PM

    Hey Jordan,


    I was not able to verify this fully,  as it is any application that you can launch - I'm guessing you can launch it on the end user workstation. However whether it can be interactive or not - I'm not sure.


    Any one with more ideas on this one?