Update-SCSMSubscription
在 Service Manager 中更新订阅属性。
语法
Update-SCSMSubscription
[-Subscription] <Subscription[]>
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
Update-SCSMSubscription cmdlet 更新 Service Manager 中的订阅属性。
示例
示例 1:更新订阅的电子邮件模板
PS C:\>Get-SCSMsubscription -DisplayName "Subscription01"
displayname description ManagementPack Enabled TimeAdded LastModified
----------- ----------- -------------- ------- --------- ------------
Subscription01 Just a description for a subscription subscriptionMP true 7/21/2010 9:10:29 PM 7/21/2010 9:10:29 PM
The second command gets the subscription that has the specified display name, and then stores it in the $Subscription variable. The third command gets the user class by using the Get-SCSMClass cmdlet, and then stores it in the $Class variable. The forth command gets an instance of the class in $Class by using the Get-SCSMClassInstance cmdlet. The command stores the instance in the $User variable. The fifth command adds a value to the **RecipientUsers** property of $Subscription. The final command updates the subscription to match the current value of $Subscription.
PS C:\>$Subscription = Get-SCSMsubscription -DisplayName "Subscription01"
PS C:\> $Subscription.Template = Get-SCSMEmailTemplate "Template2"
PS C:\> $Class = Get-SCCMClass -Name "System.Domain.User"
PS C:\> $User = Get-SCClassInstance -Class $Class -Filter "UserName -eq user"
PS C:\> $Subscription.RecipientUsers += $User.EnterpriseManagementObject
PS C:\> Update-SCSMSubscription -Subscription $Subscription
本示例更新与名为 Subscription01 的订阅一起使用的电子邮件模板,并将 woodgrove 管理员添加到收件人列表中。 第一个命令显示正在使用 Get-SCSMsubscription 更新的订阅。
参数
-Confirm
提示你在运行 cmdlet 之前进行确认。
Type: | System.Management.Automation.SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PassThru
指示此 cmdlet 返回更新的订阅。 可以将此对象传递给其他 cmdlet。
Type: | SwitchParameterSystem.Management.Automation.SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Subscription
指定此 cmdlet 更新的订阅。 若要获取订阅,请使用 Get-SCSMSubscription cmdlet。
Type: | Microsoft.EnterpriseManagement.ServiceManager.Sdk.Notifications.Subscriptions.Subscription[] |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-WhatIf
显示在此 cmdlet 运行的情况下将会发生什么。 此 cmdlet 未运行。
Type: | System.Management.Automation.SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
输入
Microsoft.EnterpriseManagement.ServiceManager.Sdk.Notifications.Subscriptions.Subscription
可以通过管道将订阅传递给 订阅 参数。
输出
None.
此 cmdlet 将不生成任何输出。