Set-CMProgram

Modifies a program in Configuration Manager.

Syntax

Set-CMProgram
   [-AfterRunningType <AfterRunningType>]
   [-Category <String>]
   [-CommandLine <String>]
   [-Comment <String>]
   [-Confirm]
   [-DisableMomAlertOnRun <Boolean>]
   [-DisableProgram <Boolean>]
   [-DisableWildcardHandling]
   [-DiskSpaceRequirement <String>]
   [-DiskSpaceUnit <DiskSpaceUnitType>]
   [-DriveLetter <String>]
   [-DriveMode <DriveModeType>]
   [-Duration <Int32>]
   [-EnableTaskSequence <Boolean>]
   [-ForceWildcardHandling]
   [-GenerateMomAlertOnFail <Boolean>]
   -InputObject <IResultObject>
   [-PassThru]
   [-ProgramAssignedType <ProgramAssignedType>]
   [-ProgramRunType <ProgramRunType>]
   [-Reconnect <Boolean>]
   [-Requirement <String>]
   [-RunMode <RunModeType>]
   [-RunType <RunType>]
   [-StandardProgram]
   [-SuppressProgramNotification <Boolean>]
   [-UserInteraction <Boolean>]
   [-WhatIf]
   [-WorkingDirectory <String>]
   [<CommonParameters>]
Set-CMProgram [-AfterRunningType ] [-Category ] [-CommandLine ]
 [-Comment ] [-Confirm] [-DisableMomAlertOnRun ] [-DisableProgram ]
 [-DisableWildcardHandling] [-DiskSpaceRequirement ] [-DiskSpaceUnit ]
 [-DriveLetter ] [-DriveMode ] [-Duration ] [-EnableTaskSequence ]
 [-ForceWildcardHandling] [-GenerateMomAlertOnFail ] -PackageName  [-PassThru]
 [-ProgramAssignedType ] -ProgramName  [-ProgramRunType ]
 [-Reconnect ] [-Requirement ] [-RunMode ] [-RunType ]
 [-StandardProgram] [-SuppressProgramNotification ] [-UserInteraction ] [-WhatIf]
 [-WorkingDirectory ] []
Set-CMProgram [-AfterRunningType ] [-Category ] [-CommandLine ]
 [-Comment ] [-Confirm] [-DisableMomAlertOnRun ] [-DisableProgram ]
 [-DisableWildcardHandling] [-DiskSpaceRequirement ] [-DiskSpaceUnit ]
 [-DriveLetter ] [-DriveMode ] [-Duration ] [-EnableTaskSequence ]
 [-ForceWildcardHandling] [-GenerateMomAlertOnFail ] -PackageId  [-PassThru]
 [-ProgramAssignedType ] -ProgramName  [-ProgramRunType ]
 [-Reconnect ] [-Requirement ] [-RunMode ] [-RunType ]
 [-StandardProgram] [-SuppressProgramNotification ] [-UserInteraction ] [-WhatIf]
 [-WorkingDirectory ] []
Set-CMProgram [-AfterRunningType ] [-Category ] [-CommandLine ]
 [-Comment ] [-Confirm] [-DisableMomAlertOnRun ] [-DisableProgram ]
 [-DisableWildcardHandling] [-DiskSpaceRequirement ] [-DiskSpaceUnit ]
 [-DriveLetter ] [-DriveMode ] [-Duration ] [-EnableTaskSequence ]
 [-ForceWildcardHandling] [-GenerateMomAlertOnFail ] -InputObject  [-PassThru]
 [-ProgramAssignedType ] -ProgramName  [-ProgramRunType ]
 [-Reconnect ] [-Requirement ] [-RunMode ] [-RunType ]
 [-StandardProgram] [-SuppressProgramNotification ] [-UserInteraction ] [-WhatIf]
 [-WorkingDirectory ] []
Set-CMProgram [-CommandLine ] [-CommandLineFolder ] [-Comment ] [-Confirm]
 [-DeviceProgram] [-DisableWildcardHandling] [-DiskSpaceRequirement ]
 [-DiskSpaceUnit ] [-DownloadProgramType ] [-ForceWildcardHandling]
 -PackageName  [-PassThru] -ProgramName  [-Requirement ] [-WhatIf]
 [-WorkingDirectory ] []
Set-CMProgram [-CommandLine ] [-CommandLineFolder ] [-Comment ] [-Confirm]
 [-DeviceProgram] [-DisableWildcardHandling] [-DiskSpaceRequirement ]
 [-DiskSpaceUnit ] [-DownloadProgramType ] [-ForceWildcardHandling]
 -PackageId  [-PassThru] -ProgramName  [-Requirement ] [-WhatIf]
 [-WorkingDirectory ] []
Set-CMProgram [-CommandLine ] [-CommandLineFolder ] [-Comment ] [-Confirm]
 [-DeviceProgram] [-DisableWildcardHandling] [-DiskSpaceRequirement ]
 [-DiskSpaceUnit ] [-DownloadProgramType ] [-ForceWildcardHandling]
 -InputObject  [-PassThru] -ProgramName  [-Requirement ] [-WhatIf]
 [-WorkingDirectory ] []
Set-CMProgram [-CommandLine ] [-CommandLineFolder ] [-Comment ] [-Confirm]
 [-DeviceProgram] [-DisableWildcardHandling] [-DiskSpaceRequirement ]
 [-DiskSpaceUnit ] [-DownloadProgramType ] [-ForceWildcardHandling]
 -InputObject  [-PassThru] [-Requirement ] [-WhatIf] [-WorkingDirectory ]
 []

Description

The Set-CMProgram cmdlet modifies 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: Modify a standard program

PS C:\> Set-CMProgram -Name "Test" -StandardProgramName SPM -Comment "Standard Upgrades" -CommandLine "RunThisNow" -RunType Maximized -AfterRunningType ProgramControlsRestart -Category "Laptops" -DiskSpaceRequirement 50 -DiskSpaceUnit MB -Duration 150 -Requirement 4 -Reconnect $False -SuppressProgramNotifications $False -DisableProgram $True -EnableTaskSequence $True -DisableMomAlertOnRun $True -GenerateMomAlertOnFail $True

This command modifies a standard program.

Example 2: Modify a device program

PS C:\> Set-CMProgram -Name "Test" -DeviceProgramName DPM -Comment "Upgrades for December" -CommandLine "RunMe" -WorkingDirectory "\TempWork" -CommandLineFolder "C:\Windows" -DiskSpaceRequirement 30 -DiskSpaceUnit MB -DownloadProgramType AsSoonAsPossible -Requirement "All previous device updates"

This command modifies a device program.

Required Parameters

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

Specifies a CMProgram object. To obtain a CMProgram object, use the Get-CMProgram cmdlet.

Type:IResultObject
Aliases:ProgramPackage, Package, Program
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-PackageId

Specifies a package ID.

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

Specifies a package name.

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

Specifies the name of the program.

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

Indicates that the program type in the deployment package is standard program.

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

Optional Parameters

-AfterRunningType

Specifies the action that occurs after the program completes successfully. The acceptable values for this parameter are:- ConfigurationManagerLogUserOff

  • ConfigurationManagerStartsComputer NoActionRequired
  • ProgramControlsRestart.
Type:AfterRunningType
Parameter Sets:NoActionRequired, ConfigurationManagerRestartsComputer, ProgramControlsRestart, ConfigurationManagerLogsUserOff
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Category

Specifies the category under which the program is displayed on the client computer.

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

Specifies the command line for the program.

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

Indicates whether the computer running the program is in maintenance mode for the duration of the program. When in maintenance mode, Microsoft Operations Manager (MOM) disables alerts while the program runs.

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

Indicates whether to temporarily disable all advertisements that contain this program. If this option is selected, the program is removed from the list of available programs for users to run and it is run through assignment until re-enabled.

Type:Boolean
Required:False
Position:Named
Default value:None
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. Requires the DiskSpaceUnit parameter be set. The value must be greater than or equal to zero.

Type:String
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 used.

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
-EnableTaskSequence

Indicates whether this program can be installed from the Install Software task sequence.

Type:Boolean
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
-GenerateMomAlertOnFail

Indicates whether Configuration Manager generates an application log event entry if the program fails.

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

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

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

Specifies whether the program runs once on the computer, or once for every user who logs on to the computer. The default setting is RunOnceForTheComputer. The program is only assigned to users when the ProgramRunType parameter is set to OnlyWhenUserIsLoggedOn.

Type:ProgramAssignedType
Parameter Sets:RunOnceForTheComputer, RunOnceForEveryUserWhoLogsOn
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 any additional requirements for standard or device programs.

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

Specifies the credentials the client computer requires to run the program. 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
-SuppressProgramNotification
Type:Boolean
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