- danovich.com.au -

For the enterprise sys admin by the enterprise sys admin

  • Home
  • About
  • Contact
  • RSS Feed

24

Jan

Force SCCM optional advertisement to run

Posted by danovich  Published in Opalis / Orchestrator, Scripting, SMS / SCCM

I needed a script that was going to run tigger optional SCCM advertisement to run. Why? Because I was using Opalis to trigger multiple advertisements across multiple systems in a certain sequence. I had tried the SCCM Client Center Integration Pack for Opalis, however the Run Advertisements function didn’t seem to work. So my Opalis workbook simply calls the below script and passes it the SCCM package ID and program name (ie force_run.vbs PACKAGEID PROGRAMNAME). See below for VBScript:


' Purpose: Forces optional advertised programs that meet packageID and program name criteria to run
' Note: There must already be a SCCM advertisement in place
' Use: force_run.vbs PACKAGEID PROGRAMNAME (case sensitive)
' Author: blog.danovich.com.au

' Get input parameters
Dim Arg, packageID, programName
Set Arg = WScript.Arguments
packageID = Arg(0)
programName = Arg(1)
Set uiResource = CreateObject("UIResource.UIResourceMgr")
Set programList = uiResource.GetAvailableApplications

' Set flags for error tracking
flag_package = "notavailable"
flag_program = "notavailable"

' Match each given packageID and program name against applications available to the machine
For each p in programList
If p.PackageID = packageID then
flag_package = "available"
If p.Name = programName Then
uiResource.ExecuteProgram p.ID, p.PackageID,True
flag_program = "available"
Exit For
End If
End If
Next

' Give feedback if the given packageID or program name do not match available applications
If flag_package = "notavailable" then
wscript.echo packageID & " does not match any Package ID in available applications"
End If
If flag_program = "notavailable" and flag_package = "available" then
wscript.echo programName & " does not match any program name in available applications or is not associated with Package ID " & packageID
End If

' Give feedback if everything matches
If flag_program = "available" and flag_package = "available" then
wscript.echo "Program name " & programName & " from package ID " & packageID & " ran successfully."
End If

' Clean up
Set uiResource = Nothing
Set Arg = Nothing

 
 

VN:F [1.9.11_1134]
please wait...
Rating: 0.0/10 (0 votes cast)
Share

Tags: advertisment, force, opalis, package, program, run, SCCM, script, trigger

no comment

Recent Posts

  • SCCM 2012 survival guide
  • List of recommended SCCM hotfixes
  • Outlook profile settings ignored in Office 2010 SP1 using OCT
  • Force SCCM optional advertisement to run

Categories

  • AntiVirus (1)
  • App-V (2)
  • Certificates (4)
  • Exchange (8)
  • Geek (19)
  • OCS / Lync (22)
  • Opalis / Orchestrator (1)
  • Scripting (27)
    • Powershell (15)
  • SMS / SCCM (62)
  • Storage (4)
  • Tools (42)
  • VMWare (3)
  • Windows (46)

Archive

  • February 2012 (3)
  • January 2012 (6)
  • December 2011 (6)
  • November 2011 (1)
  • October 2011 (4)
  • September 2011 (3)
  • August 2011 (5)
  • July 2011 (2)
  • June 2011 (1)
  • May 2011 (3)
  • April 2011 (5)
  • February 2011 (7)
  • January 2011 (5)
  • December 2010 (9)
  • November 2010 (2)
  • October 2010 (5)
  • September 2010 (3)
  • August 2010 (3)
  • July 2010 (1)
  • June 2010 (4)
  • May 2010 (4)
  • April 2010 (2)
  • March 2010 (9)
  • February 2010 (7)
  • January 2010 (8)
  • December 2009 (1)
  • November 2009 (4)
  • October 2009 (5)
  • September 2009 (3)
  • August 2009 (2)
  • June 2009 (3)
  • May 2009 (1)
  • March 2009 (2)
  • February 2009 (4)
  • January 2009 (2)
  • December 2008 (7)

Recommended Blogs

  • Michael Kleef blog
  • opsm.gr
  • Tao's System Management Blog

Tech Links

  • Best Free Windows Software
  • Dr Web online URL check
  • Environment variables
  • Live Mesh
  • Microsoft Connect
  • Microsoft Discussion Newsgroups
  • Microsoft IPD
  • Microsoft KB monitoring
  • Microsoft TechNet Forums
  • MX Lookup Tool
  • NSLookup
  • Online Script Decoder
  • PortableApps
  • Sendoid
  • Speedtest
  • SSL Certificate Check
  • This blog's 2011 annual report
  • TVCatchup.com

Recent Entries

  • SCCM 2012 survival guide
  • List of recommended SCCM hotfixes
  • Outlook profile settings ignored in Office 2010 SP1 using OCT
  • Force SCCM optional advertisement to run
  • Windows 7 on NCR RealPOS 7402
  • Free online training for System Center 2012 including SCCM
  • New licensing model for System Center 2012
  • This blog’s 2011 annual report
  • SCCM Task Sequence Monitor
  • Custom message prior to installing software

Recent Comments

  • SCCM 2012 survival guide | – … in SCCM 2012 survival guide
  • Create a SCCM collection that exclu… in Create a SCCM collection that excludes members of …
  • SCCM report of all machines of a ce… in SCCM report of all machines of a certain model
  • SCCM report to count hardware model… in SCCM report to count hardware models
  • Edit the registry inside a WIM file… in Edit the registry inside a WIM file
  • Schedule SCCM reports to be emailed… in Schedule SCCM reports to be emailed without SQL re…
  • jakre in DameWare remote control in WinPE
  • jakre in DameWare remote control in WinPE
  • Tao Yang in List of recommended SCCM hotfixes
  • danovich in Edit the registry inside a WIM file
  • Random Selection of Posts

    • Find out how many users are connected in Lync Server 2010
    • Lync Server 2010 released!
    • Outlook prompting for credentials with Exchange 2007
    • Sysprep error – Setup was unable to change the password for user account Administrator
    • SuperFlow for SCCM Operating System Deployment via PXE
    • SCCM unattended OSD with bootable USB drive
    • SCCM report to show disk space for all servers
© 2009 - danovich.com.au - is proudly powered by WordPress.