Set-CMProgram

Modifies a program in Configuration Manager.

Syntax

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

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
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
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-PackageId

Specifies a package ID.

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

Specifies a package name.

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

Optional Parameters

-AddSupportedOperatingSystemPlatform
Type:IResultObject[]
Aliases:AddSupportedOperatingSystemPlatforms
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-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
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
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-CommandLine

Specifies the command line for the program.

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

DisableWildcardHandling treats wildcard characters as literal character values. Cannot be combined with ForceWildcardHandling.

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

ForceWildcardHandling processes wildcard characters and may lead to unexpected behavior (not recommended). Cannot be combined with DisableWildcardHandling.

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

Returns the current working object. By default, this cmdlet does not generate any output.

Type:SwitchParameter
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
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
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
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RemoveSupportedOperatingSystemPlatform
Type:IResultObject[]
Aliases:RemoveSupportedOperatingSystemPlatforms
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
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
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RunOnAnyPlatform
Type:SwitchParameter
Aliases:ClearSupportedOperatingSystemPlatforms
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
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SuppressProgramNotification
Type:Boolean
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
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
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-WorkingDirectory

Specifies a working directory for the program.

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