LoginSignup
0
0

More than 1 year has passed since last update.

WSUSで承認、あるいは拒否した更新プログラムを未承認に戻したかった

Posted at

見出しのようなことは滅多にないかと思われますが、GUIではできるのであればPowerShellからも操作できるのではと思い調べてみました。

image.png

サンプル

更新プログラムを1つ、すべてのコンピューター に対して NotApproved (未承認) にしてみましょう。

$Update = @(Get-WsusUpdate -UpdateServer (Get-WsusServer))[0]
Approve-WsusUpdate -Update $Update -Action NotApproved -TargetGroupName "すべてのコンピューター"
$WsusServer = Get-WsusServer
$Updates = @($WsusServer.GetUpdates())[0]
$ComputerTargetGroup = $WsusServer.GetComputerTargetGroup([Microsoft.UpdateServices.Administration.ComputerTargetGroupId]::AllComputers)
$Update.Approve([Microsoft.UpdateServices.Administration.UpdateApprovalAction]::NotApproved,$ComputerTargetGroup)

$Update には、サンプルなのでとりあえずなんでもいいので1つ目の更新プログラムを取得しています。
本番環境での更新プログラムの抽出に、こんな乱暴な書き方をしてはいけません。
関数によって返ってくる1つ目の更新プログラムは異なりますが、結果は同じためサンプルとして掲載しました。

結果

すると、いずれも InvalidOperationException となります。
なぜか"すべてのコンピューター"に対してはできないようになっているようです。

希望された更新プログラムの承認は、指定されたコンピューター ターゲット グループに対して無効です。
The desired update approval is not valid for the specified computer target group.

InvalidOperationException

(中略)

  • You cannot create a block approval to the All Computers target group.
  • The desired action cannot be used because a dependency has been approved for the opposite action.

https://learn.microsoft.com/ja-jp/previous-versions/windows/desktop/ms747134(v=vs.85) 引用

NotApproved

  • (中略) This value can be used in a simple targeting ComputerTargetGroup to "override" a UpdateApproval made to the "All Computers" ComputerTargetGroup.

https://learn.microsoft.com/ja-jp/previous-versions/windows/desktop/ms752788(v=vs.85) 引用

メモ

ちなみにですが、"すべてのコンピューター"でなければ可能なようです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0