Set-CMProgram
修改包的程序。
语法
Set-CMProgram
   [-AddSupportedOperatingSystemPlatform <IResultObject[]>]
   [-AfterRunningType <AfterRunningType>]
   [-Category <String>]
   [-CommandLine <String>]
   [-Comment <String>]
   [-DisableMomAlertOnRun <Boolean>]
   [-DisableProgram <Boolean>]
   [-DiskSpaceRequirement <String>]
   [-DiskSpaceUnit <DiskSpaceUnitType>]
   [-DriveLetter <String>]
   [-DriveMode <DriveModeType>]
   [-Duration <Int32>]
   [-EnableTaskSequence <Boolean>]
   [-GenerateMomAlertOnFail <Boolean>]
   -InputObject <IResultObject>
   [-PassThru]
   [-ProgramAssignedType <ProgramAssignedType>]
   [-ProgramRunType <ProgramRunType>]
   [-Reconnect <Boolean>]
   [-RemoveSupportedOperatingSystemPlatform <IResultObject[]>]
   [-Requirement <String>]
   [-RunMode <RunModeType>]
   [-RunOnAnyPlatform]
   [-RunType <RunType>]
   [-StandardProgram]
   [-SuppressProgramNotification <Boolean>]
   [-UserInteraction <Boolean>]
   [-WorkingDirectory <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]Set-CMProgram
   [-AddSupportedOperatingSystemPlatform <IResultObject[]>]
   [-AfterRunningType <AfterRunningType>]
   [-Category <String>]
   [-CommandLine <String>]
   [-Comment <String>]
   [-DisableMomAlertOnRun <Boolean>]
   [-DisableProgram <Boolean>]
   [-DiskSpaceRequirement <String>]
   [-DiskSpaceUnit <DiskSpaceUnitType>]
   [-DriveLetter <String>]
   [-DriveMode <DriveModeType>]
   [-Duration <Int32>]
   [-EnableTaskSequence <Boolean>]
   [-GenerateMomAlertOnFail <Boolean>]
   -PackageName <String>
   [-PassThru]
   [-ProgramAssignedType <ProgramAssignedType>]
   -ProgramName <String>
   [-ProgramRunType <ProgramRunType>]
   [-Reconnect <Boolean>]
   [-RemoveSupportedOperatingSystemPlatform <IResultObject[]>]
   [-Requirement <String>]
   [-RunMode <RunModeType>]
   [-RunOnAnyPlatform]
   [-RunType <RunType>]
   [-StandardProgram]
   [-SuppressProgramNotification <Boolean>]
   [-UserInteraction <Boolean>]
   [-WorkingDirectory <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]Set-CMProgram
   [-AddSupportedOperatingSystemPlatform <IResultObject[]>]
   [-AfterRunningType <AfterRunningType>]
   [-Category <String>]
   [-CommandLine <String>]
   [-Comment <String>]
   [-DisableMomAlertOnRun <Boolean>]
   [-DisableProgram <Boolean>]
   [-DiskSpaceRequirement <String>]
   [-DiskSpaceUnit <DiskSpaceUnitType>]
   [-DriveLetter <String>]
   [-DriveMode <DriveModeType>]
   [-Duration <Int32>]
   [-EnableTaskSequence <Boolean>]
   [-GenerateMomAlertOnFail <Boolean>]
   -PackageId <String>
   [-PassThru]
   [-ProgramAssignedType <ProgramAssignedType>]
   -ProgramName <String>
   [-ProgramRunType <ProgramRunType>]
   [-Reconnect <Boolean>]
   [-RemoveSupportedOperatingSystemPlatform <IResultObject[]>]
   [-Requirement <String>]
   [-RunMode <RunModeType>]
   [-RunOnAnyPlatform]
   [-RunType <RunType>]
   [-StandardProgram]
   [-SuppressProgramNotification <Boolean>]
   [-UserInteraction <Boolean>]
   [-WorkingDirectory <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]Set-CMProgram
   [-AddSupportedOperatingSystemPlatform <IResultObject[]>]
   [-AfterRunningType <AfterRunningType>]
   [-Category <String>]
   [-CommandLine <String>]
   [-Comment <String>]
   [-DisableMomAlertOnRun <Boolean>]
   [-DisableProgram <Boolean>]
   [-DiskSpaceRequirement <String>]
   [-DiskSpaceUnit <DiskSpaceUnitType>]
   [-DriveLetter <String>]
   [-DriveMode <DriveModeType>]
   [-Duration <Int32>]
   [-EnableTaskSequence <Boolean>]
   [-GenerateMomAlertOnFail <Boolean>]
   -InputObject <IResultObject>
   [-PassThru]
   [-ProgramAssignedType <ProgramAssignedType>]
   -ProgramName <String>
   [-ProgramRunType <ProgramRunType>]
   [-Reconnect <Boolean>]
   [-RemoveSupportedOperatingSystemPlatform <IResultObject[]>]
   [-Requirement <String>]
   [-RunMode <RunModeType>]
   [-RunOnAnyPlatform]
   [-RunType <RunType>]
   [-StandardProgram]
   [-SuppressProgramNotification <Boolean>]
   [-UserInteraction <Boolean>]
   [-WorkingDirectory <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]Set-CMProgram
   [-CommandLine <String>]
   [-CommandLineFolder <String>]
   [-Comment <String>]
   [-DeviceProgram]
   [-DiskSpaceRequirement <String>]
   [-DiskSpaceUnit <DiskSpaceUnitType>]
   [-DownloadProgramType <DownloadProgramType>]
   -PackageName <String>
   [-PassThru]
   -ProgramName <String>
   [-Requirement <String>]
   [-WorkingDirectory <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]Set-CMProgram
   [-CommandLine <String>]
   [-CommandLineFolder <String>]
   [-Comment <String>]
   [-DeviceProgram]
   [-DiskSpaceRequirement <String>]
   [-DiskSpaceUnit <DiskSpaceUnitType>]
   [-DownloadProgramType <DownloadProgramType>]
   -PackageId <String>
   [-PassThru]
   -ProgramName <String>
   [-Requirement <String>]
   [-WorkingDirectory <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]Set-CMProgram
   [-CommandLine <String>]
   [-CommandLineFolder <String>]
   [-Comment <String>]
   [-DeviceProgram]
   [-DiskSpaceRequirement <String>]
   [-DiskSpaceUnit <DiskSpaceUnitType>]
   [-DownloadProgramType <DownloadProgramType>]
   -InputObject <IResultObject>
   [-PassThru]
   -ProgramName <String>
   [-Requirement <String>]
   [-WorkingDirectory <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]Set-CMProgram
   [-CommandLine <String>]
   [-CommandLineFolder <String>]
   [-Comment <String>]
   [-DeviceProgram]
   [-DiskSpaceRequirement <String>]
   [-DiskSpaceUnit <DiskSpaceUnitType>]
   [-DownloadProgramType <DownloadProgramType>]
   -InputObject <IResultObject>
   [-PassThru]
   [-Requirement <String>]
   [-WorkingDirectory <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]说明
使用此 cmdlet 修改包的程序。 程序标识客户端收到客户端包时发生的操作。 可以将多个程序与同一个包相关联。 有关详细信息,请参阅 Configuration Manager 中的包和程序。
注意
从 Configuration Manager 站点驱动器运行 Configuration Manager cmdlet,例如 PS XYZ:\>。 有关详细信息,请参阅 入门。
示例
示例 1:修改标准程序
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示例 2:修改设备程序
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"示例 3:添加受支持的 OS 平台
此示例设置与标准包关联的程序的 OS 要求。 它使用 Get-CMSupportedPlatform cmdlet 获取指定平台的对象。 然后,它使用此支持的平台对象来配置程序。
$ProgramName = 'Script'
$PackageID = 'XYZ0000D'
$Platform = 'All Windows 10 (64-bit) Client'
$OS = Get-CMSupportedPlatform -Name $Platform -Fast
Set-CMProgram -PackageID $PackageID -ProgramName $ProgramName -AddSupportedOperatingSystemPlatform $OS -StandardProgram参数
-AddSupportedOperatingSystemPlatform
指定要为程序添加的一个或多个受支持的 OS 平台。 若要获取此对象,请使用 Get-CMSupportedPlatform cmdlet。
| 类型: | IResultObject[] | 
| 别名: | AddSupportedOperatingSystemPlatforms | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-AfterRunningType
指定在程序成功完成后发生的操作。
| 类型: | AfterRunningType | 
| 接受的值: | NoActionRequired, ConfigurationManagerRestartsComputer, ProgramControlsRestart, ConfigurationManagerLogsUserOff | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-Category
指定在客户端计算机上显示该程序的类别。
| 类型: | String | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-CommandLine
指定程序的命令行。
| 类型: | String | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-CommandLineFolder
指定包含可执行程序的文件夹。 此文件夹可以是客户端上的绝对路径,也可以是相对于包含包的分发文件夹的路径。
| 类型: | String | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-Comment
指定有关程序的可选文本,例如说明。 在客户端计算机上,此文本与软件中心中的程序一起显示。
| 类型: | String | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-Confirm
提示你在运行 cmdlet 之前进行确认。
| 类型: | SwitchParameter | 
| 别名: | cf | 
| Position: | Named | 
| 默认值: | False | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-DeviceProgram
添加此参数可将此程序配置为设备程序。
| 类型: | SwitchParameter | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | True | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-DisableMomAlertOnRun
指示运行程序的计算机在程序期间是否处于维护模式。 处于维护模式时,System Center Operations Manager 会在程序运行时禁用警报。
| 类型: | Boolean | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-DisableProgram
将此参数设置为 $true 可暂时禁用包含此程序的所有部署。 还可以使用 Disable-CMProgram cmdlet。
| 类型: | Boolean | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-DisableWildcardHandling
此参数将通配符视为文本字符值。 不能将其与 ForceWildcardHandling 组合使用。
| 类型: | SwitchParameter | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-DiskSpaceRequirement
指定软件程序在计算机上运行所需的磁盘空间量。 该值必须大于或等于零。 如果指定值,请使用 DiskSpaceUnit 参数指定该值的单位。
| 类型: | String | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-DiskSpaceUnit
为 DiskSpaceRequirement 参数指定接受的单位。
| 类型: | DiskSpaceUnitType | 
| 接受的值: | KB, MB, GB | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-DownloadProgramType
指定程序何时运行。
| 类型: | DownloadProgramType | 
| 接受的值: | AsSoonAsPossible, OnlyOverFastNetwork, OnlyWhenTheDeviceIsDocked | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-DriveLetter
如果使用 DriveMode 参数,请为位置指定驱动器号。
| 类型: | String | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-DriveMode
指示程序是否需要 DriveLetter 参数中指定的特定驱动器号。
- RunWithUnc:从 UNC 路径运行程序。 此值为默认值。 从版本 2010 开始,此值已从- RenameWithUnc重命名。
- RequiresDriveLetter:程序使用任何可用的驱动器号。
- RequiresSpecificDriveLetter:仅当驱动器尚未使用时,程序才会运行。
| 类型: | DriveModeType | 
| 接受的值: | RunWithUnc, RequiresDriveLetter, RequiresSpecificDriveLetter | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-Duration
指定预期程序运行的最长时间。 默认值为 120 分钟。
| 类型: | Int32 | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-EnableTaskSequence
指示是否可以从 安装包 任务序列步骤安装此程序。
| 类型: | Boolean | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-ForceWildcardHandling
此参数处理通配符,并可能导致意外行为, (不建议) 。 不能将其与 DisableWildcardHandling 组合使用。
| 类型: | SwitchParameter | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-GenerateMomAlertOnFail
指示如果程序失败,Configuration Manager 是否生成应用程序日志事件条目。
| 类型: | Boolean | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-InputObject
指定要配置的程序对象。 若要获取此对象,请使用 Get-CMProgram cmdlet。
| 类型: | IResultObject | 
| 别名: | ProgramPackage, Package, Program | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | True | 
| 接受管道输入: | True | 
| 接受通配符: | False | 
-PackageId
指定要配置的程序的包 ID。
| 类型: | String | 
| 别名: | Id | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | True | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-PackageName
使用要配置的程序指定包名称。
| 类型: | String | 
| 别名: | Name | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | True | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-PassThru
返回一个 对象,该对象表示正在使用的项。 默认情况下,此 cmdlet 可能不会生成任何输出。
| 类型: | SwitchParameter | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-ProgramAssignedType
指定程序是在计算机上运行一次,还是针对登录到计算机的每个用户运行一次。 默认值为 RunOnceForTheComputer。 仅当 ProgramRunType 参数设置为 OnlyWhenUserIsLoggedOn时,才会将程序分配给用户。
| 类型: | ProgramAssignedType | 
| 接受的值: | RunOnceForTheComputer, RunOnceForEveryUserWhoLogsOn | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-ProgramName
指定要配置的程序的名称。
| 类型: | String | 
| 别名: | StandardProgramName, DeviceProgramName | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | True | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-ProgramRunType
指定程序运行所需的登录条件。 默认值为 OnlyWhenUserIsLoggedOn。
| 类型: | ProgramRunType | 
| 接受的值: | OnlyWhenUserIsLoggedOn, WhetherOrNotUserIsLoggedOn, OnlyWhenNoUserIsLoggedOn | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-Reconnect
指示客户端计算机在用户登录时是否重新连接到分发点。
| 类型: | Boolean | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-RemoveSupportedOperatingSystemPlatform
指定要为程序删除的一个或多个受支持的 OS 平台。 若要获取此对象,请使用 Get-CMSupportedPlatform cmdlet。
| 类型: | IResultObject[] | 
| 别名: | RemoveSupportedOperatingSystemPlatforms | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-Requirement
指定标准程序或设备程序的任何其他要求。
| 类型: | String | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-RunMode
指定客户端计算机运行程序所需的凭据。
| 类型: | RunModeType | 
| 接受的值: | RunWithUserRights, RunWithAdministrativeRights | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-RunOnAnyPlatform
添加此参数以从此程序清除所有受支持的 OS 平台。
| 类型: | SwitchParameter | 
| 别名: | ClearSupportedOperatingSystemPlatforms | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-RunType
指定程序在客户端计算机上运行的模式。 默认值为 Normal。
| 类型: | RunType | 
| 接受的值: | Normal, Minimized, Maximized, Hidden | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-StandardProgram
指示部署包中的程序类型是标准程序。
| 类型: | SwitchParameter | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | True | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-SuppressProgramNotification
将此参数设置为 $true 以禁止显示程序通知。
| 类型: | Boolean | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-UserInteraction
指示是否允许用户与程序交互。
| 类型: | Boolean | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-WhatIf
显示在 cmdlet 运行时发生的情况。 cmdlet 不会运行。
| 类型: | SwitchParameter | 
| 别名: | wi | 
| Position: | Named | 
| 默认值: | False | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
-WorkingDirectory
指定程序的工作目录。
| 类型: | String | 
| Position: | Named | 
| 默认值: | None | 
| 必需: | False | 
| 接受管道输入: | False | 
| 接受通配符: | False | 
输入
Microsoft.ConfigurationManagement.ManagementProvider.IResultObject
输出
System.Object