Create an Application in ConfigMgr 2012 R2 with PowerShell

This PowerShell code is designed to create a new Configuration Manager Application, as per Chapter 7 in “Learn ConfigMgr 2012 in a Month of Lunches“.

While the code is specific for the lab environment, it will work for any Program in Configuration Manager 2012 R2.

# Define Configuration Manager variables
 
$CMSiteCode = 'P01'
$CMSiteServer = 'LAB-CM01.mol.sccmlab.net'
$CMNameSpace = "root\SMS\site_$CMSiteCode"
$ApplicationName = 'Paint.NET v3.5.11'
 
# 1.0 Create new Application
 
New-CMApplication -Name $ApplicationName -LocalizedApplicationName $ApplicationName
 
$Application = Get-CMApplication -Name $ApplicationName
 
# 1.1 Create x64 Deployment Type
 
Add-CMDeploymentType -ApplicationName $Application.LocalizedDisplayName `
  -AutoIdentifyFromInstallationFile `
  -ForceForUnknownPublisher $true `
  -InstallationFileLocation '\\LAB-CM01\Sources\Software\Paint.NET\3.5.11\x64\PaintDotNet.x64.msi' `
  -MsiInstaller `
  -DeploymentTypeName 'Paint.NET v3.5.11 (x64) - Windows Installer (*.msi file)'
 
# 1.2 Create x86 Deployment Type
 
Add-CMDeploymentType -ApplicationName $Application.LocalizedDisplayName `
  -AutoIdentifyFromInstallationFile `
  -ForceForUnknownPublisher $true `
  -InstallationFileLocation '\\lab-cm01\Sources\Software\Paint.NET\3.5.11\x86\PaintDotNet.x86.msi' `
  -MsiInstaller `
  -DeploymentTypeName 'Paint.NET v3.5.11 (x86) - Windows Installer (*.msi file)'

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>