SCCM 2012 PowerShell: Create a Global Condition Rule

As I already mentioned using PowerShell with SCCM 2012 is still not optimal. Automating application creation and maintenance is still a lot of manual work. Today I want to show you an solution I created to add an Global condition to a deployment rule.

The advantage you can create is that an application installs only when the hardware is valid according to your policies. Until now there is no function you can call which create a global condition rule. Continue reading SCCM 2012 PowerShell: Create a Global Condition Rule

Create RegistrySetting object with PowerShell

In the comment of the blog “Creating a SCCM 2012 Application” Adam asked the question if it could be expanded with adding Enhanched detection method. Because there isn’t still a good SDK I started to do a little research.I found a great post from Adam Meltzer (link).
Continue reading Create RegistrySetting object with PowerShell

Deploy SCCM Application with PowerShell

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()