New-CMProgram

Create a new program for a package.

Syntax

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

Description

Use this cmdlet to create a program for a package. Programs are commands that are associated with a Configuration Manager package. They identify the actions that occur when the client receives the client package. You can associate multiple programs with the same package. For more information, see Packages and programs in Configuration Manager.

Note

Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>. For more information, see getting started.

Examples

Example 1: Create a program

This example first splats the cmdlet parameters into the parameters variable. It's not required to splat the parameters, it just makes it easier to read the parameters for such a long command line.

This command creates a program named Scan x64 in the default User State Migration Tool for Windows package.

$parameters = @{
  PackageName = "User State Migration Tool for Windows"
  StandardProgramName = "Scan x64"
  CommandLine = "amd64\scanstate.exe \\gold\sources$\userdata /i:miguser.xml /i:migapp.xml /o"
  RunType = "Normal"
  ProgramRunType = "OnlyWhenNoUserIsLoggedOn"
  DiskSpaceRequirement = 200
  DiskSpaceUnit = "MB"
  Duration = 100
  DriveMode = "RunWithUnc"
}
New-CMProgram @parameters

Parameters

-AddSupportedOperatingSystemPlatform

Specify one or more supported OS platforms to add for the program. To get this object, use the Get-CMSupportedPlatform cmdlet.

Type:IResultObject[]
Aliases:AddSupportedOperatingSystemPlatforms
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CommandLine

Specify the command line for the program.

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

-CommandLineFolder

Specify 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
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Comment

Specify optional text about the program, such as a description. On client computers, this text displays with the program in Software Center.

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

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-DeviceProgramName

Specifies a device program name.

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

-DisableWildcardHandling

This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.

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

-DiskSpaceRequirement

Specify the amount of disk space that the software program requires to run on the computer. The value must be greater than or equal to zero. If you specify a value, use the DiskSpaceUnit parameter to specify units for the value.

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

-DiskSpaceUnit

Specify an accepted unit for the DiskSpaceRequirement parameter.

Type:DiskSpaceUnitType
Accepted values:KB, MB, GB
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DownloadProgramType

Specify when the program is to run.

Type:DownloadProgramType
Accepted values:AsSoonAsPossible, OnlyOverFastNetwork, OnlyWhenTheDeviceIsDocked
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DriveLetter

If you use the DriveMode parameter, specify a drive letter for the location.

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

-DriveMode

Indicates whether the program requires a specific drive letter, specified in the DriveLetter parameter.

  • RunWithUnc: Run the program from the UNC path. This value is the default. Starting in version 2010, this value was renamed from RenameWithUnc.

  • RequiresDriveLetter: The program uses any available drive letter.

  • RequiresSpecificDriveLetter: The program only runs if the drive isn't already in use.

Type:DriveModeType
Accepted values:RunWithUnc, RequiresDriveLetter, RequiresSpecificDriveLetter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Duration

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

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

-ForceWildcardHandling

This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.

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

-PackageId

Specify the ID of the package for this program.

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

-PackageName

Specify a package name for this program.

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

-ProgramRunType

Specifies the logon conditions that are necessary for the program to run.

The default setting is OnlyWhenUserIsLoggedOn.

Type:ProgramRunType
Accepted values:OnlyWhenUserIsLoggedOn, WhetherOrNotUserIsLoggedOn, OnlyWhenNoUserIsLoggedOn
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Reconnect

Indicates whether the client computer reconnects to the distribution point when the user signs in to Windows.

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

-Requirement

Specifies additional requirements for standard or device programs.

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

-RunMode

Specify the credentials that the program requires to run on the client computer.

Type:RunModeType
Accepted values:RunWithUserRights, RunWithAdministrativeRights
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RunType

Specify the mode in which the program runs on the client computer.

The default value is Normal.

Type:RunType
Accepted values:Normal, Minimized, Maximized, Hidden
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-StandardProgramName

Specify the standard program name.

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

-UserInteraction

Indicates whether to allow users to interact with the program.

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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet doesn't run.

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

-WorkingDirectory

Specify a working directory for the program.

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

Inputs

None

Outputs

IResultObject

Notes

For more information on this return object and its properties, see SMS_Program server WMI class.