Create a Package in ConfigMgr 2012 R2 with PowerShell

This PowerShell code is designed to create a new Configuration Manager Package for Notepad++ as well as an installation Program for the new Package, as per Chapter 8 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 = "rootSMSsite_$CMSiteCode"
$PackageName = 'Notepad++ 6.6.9'
 
# 1.0 Create new Package
 
New-CMPackage -Name $PackageName -Path 'lab-cm01SourcesSoftwareNotepad++6.5.2'
 
# 1.1 Create new Program
 
New-CMProgram -PackageName $PackageName 
  -StandardProgramName 'Install - Notepad++ 6.6.9' 
  -CommandLine 'npp.6.6.9.Installer.exe /S' 
  -RunType Hidden 
  -RunMode RunWithAdministrativeRights 
  -UserInteraction $false 
  -ProgramRunType WhetherOrNotUserIsLoggedOn 
  -DriveMode RenameWithUnc

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>