How to Run a Program on a Configuration Manager Client: "How to Run a Program on a Configuration Manager Client"
I found that the code included on the webpage didn't work when used in VBscript.
This code does:
Runprogram "ProgramName","ProgID"
Sub RunProgram(programId, packageId)
'On Error Resume Next
Dim oUIResource
Dim oPrograms
Dim oProgram
Set oUIResource = CreateObject ("UIResource.UIResourceMgr")
If oUIResource Is Nothing Then
wscript.echo "Could not create Resource Object - quitting"
Exit Sub
End If
if oUIResource.IsMandatoryProgramPending = 1 Then
Wscript.Echo "Mandatory program pending. Try again later."
Set oUIResource=Nothing
Exit Sub
End If
Set oProgram = oUIResource.GetProgram(programId,packageId)
if oProgram is Nothing Then
WScript.Echo "Couldn't get the program"
Set oUIResource=Nothing
Exit Sub
End If
Wscript.Echo "Running program: " & oProgram.FullName
oUIResource.ExecuteProgram programId, packageID, TRUE
Set oProgram=Nothing
Set oUIResource=Nothing
End Sub
No comments :
Post a Comment