locked
How to trigger a Package via Powershell script on computer, we are using in SCCM 2012 RRS feed

  • Question

  • Hello,

    i find script to trigger Application on clients machine in software center, however i do not find script to trigger Package installaion

    Hint : i have deployed a pcakge in hidden mode as available, need script to trriger it as an when needed

    https://social.technet.microsoft.com/Forums/en-US/84354faf-d811-481b-af96-3b682b08db21/trigger-an-applicationtask-sequence-via-powershell?forum=configmanagersdk

    Kind Regards

    Tanoj


    OSLM ENGINEER - SCCM 2007 & 2012

    Thursday, December 13, 2018 10:44 AM

All replies

  • This should work: https://kelleymd.wordpress.com/2015/02/08/run-local-advertisement-with-triggerschedule/

    Jason | https://home.configmgrftw.com | @jasonsandys

    • Proposed as answer by Yuxiang Shi Friday, December 14, 2018 3:01 AM
    Thursday, December 13, 2018 3:46 PM
  • Dear Jason,

    Merry Christmas to you !!!

    with below piece of script i am able to view the packages deployed to the computer , however i am not getting how do it trigger a specific package (PKG_PackageID : PCA0005A)

    output of the script :

    PRG_ProgramName       : advertismentdummy
    PRG_ProgramID         : advertismentdummy
    PKG_Name              : Eforms Templates
    PKG_PackageID         : PCA0005A
    ADV_AdvertisementID   : PCA20041
    ADV_ExpirationTime    : 
    ADV_RepeatRunBehavior : RerunAlways

    gwmi -Namespace root\ccm\policy\machine\actualconfig -class CCM_SoftwareDistribution | select PRG_ProgramName,PRG_ProgramID,PKG_Name,PKG_PackageID,ADV_AdvertisementID,ADV_ExpirationTime,ADV_RepeatRunBehavior
    
    
    
    
    



    OSLM ENGINEER - SCCM 2007 & 2012

    Tuesday, December 25, 2018 1:32 PM
  • Dear Jason,

    i think i have found the solution, will test it and update this thread

    Thank you

    $PackageID1 = "PCA0005A"
    $computerName = $env:computername
    $comp = [wmiclass]”\\$($computerName)\root\ccm:SMS_Client”
    $ScheduledMessageID = (gwmi -cn $computerName -Namespace ROOT\CCM\Policy\Machine\ActualConfig -Class CCM_Scheduler_ScheduledMessage -filter "ScheduledMessageID like '%$PackageID1%'").ScheduledMessageID
    $comp.TriggerSchedule($ScheduledMessageID)


    OSLM ENGINEER - SCCM 2007 & 2012

    Tuesday, December 25, 2018 1:59 PM