New-CMProgram

Creates a new program in Configuration Manager.

Syntax

New-CMProgram
   -CommandLine <String>
   [-CommandLineFolder <String>]
   [-Comment <String>]
   [-Confirm]
   -DeviceProgramName <String>
   [-DisableWildcardHandling]
   [-DiskSpaceRequirement <String>]
   [-DiskSpaceUnit <DiskSpaceUnitType>]
   [-DownloadProgramType <DownloadProgramType>]
   [-ForceWildcardHandling]
   -PackageId <String>
   [-Requirement <String>]
   [-WhatIf]
   [-WorkingDirectory <String>]
   [<CommonParameters>]
New-CMProgram -CommandLine  [-CommandLineFolder ] [-Comment ] [-Confirm]
 -DeviceProgramName  [-DisableWildcardHandling] [-DiskSpaceRequirement ]
 [-DiskSpaceUnit ] [-DownloadProgramType ] [-ForceWildcardHandling]
 -PackageName  [-Requirement ] [-WhatIf] [-WorkingDirectory ] []
New-CMProgram -CommandLine  [-Confirm] [-DisableWildcardHandling] [-DiskSpaceRequirement ]
 [-DiskSpaceUnit ] [-DriveLetter ] [-DriveMode ] [-Duration ]
 [-ForceWildcardHandling] -PackageName  [-ProgramRunType ] [-Reconnect ]
 [-RunMode ] [-RunType ] -StandardProgramName  [-UserInteraction ]
 [-WhatIf] [-WorkingDirectory ] []
New-CMProgram -CommandLine  [-Confirm] [-DisableWildcardHandling] [-DiskSpaceRequirement ]
 [-DiskSpaceUnit ] [-DriveLetter ] [-DriveMode ] [-Duration ]
 [-ForceWildcardHandling] -PackageId  [-ProgramRunType ] [-Reconnect ]
 [-RunMode ] [-RunType ] -StandardProgramName  [-UserInteraction ]
 [-WhatIf] [-WorkingDirectory ] []

Description

The New-CMProgram cmdlet creates a program in Microsoft System Center Configuration Manager. Programs are commands that are associated with a System Center Configuration Manager package. Programs identify the actions that occur when the client receives the client package. You can associate multiple programs with the same package.

Examples

Example 1: Create a standard program

PS C:\> New-CMProgram -PackageName "test" -StandardProgramName SPM -CommandLine "RunMe" -WorkingDirectory "C:\temp" -RunType Hidden -ProgramRunType OnlyWhenNoUserIsLoggedOn -DiskSpaceRequirement 100 -DiskSpaceUnit GB -Duration 100 -DriveMode RenameWithUnc

This command creates a standard program in Configuration Manager.

Example 2: Create a device program

PS C:\> New-CMProgram -PackageName "Contoso-12" -DeviceProgramName DPM -Comment "Upgrades for December" -WorkingDirectory "C:\temp" -CommandLine "RunMe" -CommandLineFolder "C:\Windows\" -DiskSpaceRequirement 10 -DiskSpaceUnit GB -DownloadProgramType OnlyWhenTheDeviceIsDocked -Requirement "All previous updates"

This command creates a device program in Configuration Manager.

Required Parameters

-CommandLine

Specifies the command line for the program.

Type:String
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DeviceProgramName

Specifies a device program name.

Type:String
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PackageId
Type:String
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PackageName

Specifies a package name.

Type:String
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-StandardProgramName

Specifies the standard program name.

Type:String
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-CommandLineFolder

Specifies the folder that contains the executable program. This folder can be an absolute path on the client, or a path relative to the distribution folder that contains the package.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Comment

Specifies optional text about a program, such as a description. On client computers, this text is displayed in Run Advertised Programs in Control Panel.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-DisableWildcardHandling

Indicates that wildcard handling is disabled.

Type:SwitchParameter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DiskSpaceRequirement

Specifies the amount of disk space that the software program requires to run on the computer. If a value is specified, units for the value must also be specified. The value must be greater than or equal to zero.

Type:String
Aliases:DiskSpaceReq
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DiskSpaceUnit

Specifies the units for the DiskSpaceRequirement parameter. The acceptable values for this parameter are: GB, KB, and MB.

Type:DiskSpaceUnitType
Parameter Sets:KB, MB, GB
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DownloadProgramType

Specifies when the program is to run. The acceptable values for this parameter are:- AsSoonAsPossible

  • OnlyOverFastNetwork
  • OnlyWhenTheDeviceIsLocked.
Type:DownloadProgramType
Parameter Sets:AsSoonAsPossible, OnlyOverFastNetwork, OnlyWhenTheDeviceIsDocked
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DriveLetter

Specifies a drive letter to qualify the location if the DriveMode parameter is used.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DriveMode

Indicates whether the program requires a specific drive letter, specified in the DriveLetter parameter. By default, the program runs with a Universal Naming Convention (UNC) name. If DriveMode is set to RequiresDriveLetter, the program uses any available drive letter. If DriveMode is set to RequiresSpecificDriveLetter, the program only runs if the drive is not already in use.

Type:DriveModeType
Parameter Sets:RenameWithUnc, RequiresDriveLetter, RequiresSpecificDriveLetter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Duration

Specifies the maximum amount of time the program is expected to run. The default value is 120 minutes.

Type:Int32
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ForceWildcardHandling

Indicates that wildcard handling is enabled.

Type:SwitchParameter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ProgramRunType

Specifies the logon conditions that are necessary for the program to run. The acceptable values for this parameter are:- OnlyWhenNoUserIsLoggedOn

  • OnlyWhenUserIsLoggedOn
  • WhetherOrNotUserIsLoggedOn

    The default setting is OnlyWhenUserIsLoggedOn.
Type:ProgramRunType
Parameter Sets:OnlyWhenUserIsLoggedOn, WhetherOrNotUserIsLoggedOn, OnlyWhenNoUserIsLoggedOn
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Reconnect

Indicates whether the client computer reconnects to the distribution point when the user logs on.

Type:Boolean
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Requirement

Specifies additional requirements for standard or device programs.

Type:String
Aliases:Requirements
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RunMode

Specifies the credentials that the program requires to run on the client computer. The acceptable values for this parameter are: RunWithAdministrativeRights and RunWithUserRights.

Type:RunModeType
Parameter Sets:RunWithUserRights, RunWithAdministrativeRights
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RunType

Specifies the mode is which the program will run on the client computer. The acceptable values for this parameter are:- Hidden

  • Maximized
  • Minimized
  • Normal

    The default is Normal.
Type:RunType
Parameter Sets:Normal, Minimized, Maximized, Hidden
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-UserInteraction

Indicates whether to allow users to interact with the program.

Type:Boolean
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-WorkingDirectory

Specifies a working directory for the program.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False