0

I'm using SCCM 2007 and Powershell to automate some mundane tasks in my environment. One of these tasks is to remove all expired or superseded updates in all of my deployment packages. I've went over the Microsoft documentation for the SMS_SoftwareUpdatesPackage WMI class and the RemoveContent method you're supposed to use for this function but keep hitting a wall.

Here's the code I'm currently using.

$x = gwmi SMS_SoftwareUpdatesPackage -computer sccm -namespace root\sms\site_unh -filter "PackageID = 'UNH00277'"
$array = @()
$array += 34827
$x.RemoveContent($array,$true)

Pretty simple, right? I've tried so many different combinations of syntax I'm going crazy. The only lead I've been tracking is that maybe my array datatype isn't right. According to the documentation, it's supposed to be a UInt32 Array but that's just a hunch.

4

1 回答 1

0

对此的“解决方案”是简单地将 $ErrorActionPreference 设置为 SilentlyContinue 以跳过此故障。添加后,它成功删除了我想要的所有更新。

于 2012-03-04T14:48:27.987 回答