It has been a while since the last time I blogged. In this post I will show the last step in my PowerShell script thats create and deploy an application in SCCM 2012. The steps of the script are
- Create Application SCCM 2012 XML
- Import XML into SCCM 2012
- Create Collection
- Create Collection Rule
- Distribute Content to Distribution group
- Deploy Application to collection
I will explain the last step of this script. Altough it is a simple step it was hard to discover how it worked. In 2012 deploying an application is actually assigning an application to a collection. It therefore uses the wmi class SMS_ApplicationAssignment. To deploy an application al you have to do is to create an instance, fill it with values en save it. An example is shown below
$ApplicationAssignmentClass = [wmiclass] "\\$($SccmServer.Machine)\$($SccmServer.Namespace):SMS_ApplicationAssignment"
$newApplicationAssingment = $ApplicationAssignmentClass.CreateInstance()
$newApplicationAssingment.ApplicationName = "Microsoft Office 2013 NL"
$newApplicationAssingment.AssignmentName = "Deploy Microsoft Office 2013"
$newApplicationAssingment.AssignedCIs = $CI_ID
$newApplicationAssingment.CollectionName = $ColllectionName
$newApplicationAssingment.CreationTime = "20120101120000.000000+***"
$newApplicationAssingment.LocaleID = 1043
$newApplicationAssingment.SourceSite = "S01
$newApplicationAssingment.StartTime = "20120101120000.000000+***"
$newApplicationAssingment.SuppressReboot = $true
$newApplicationAssingment.NotifyUser = $true
$newApplicationAssingment.TargetCollectionID = $CollectionID
$newApplicationAssingment.OfferTypeID = 2
$newApplicationAssingment.WoLEnabled = $false
$newApplicationAssingment.RebootOutsideOfServiceWindows = $false
$newApplicationAssingment.OverrideServiceWindows = $false
$newApplicationAssingment.UseGMTTimes = $true
[void] $newApplicationAssingment.Put()