我尝试构建PowerShell模块以帮助诊断SCCM问题,而不会让系统管理员访问SCCM控制台。下面的代码目前在系统上找到所有缺失的补丁但我希望能够组织它们:
- 按部署名称整理补丁
- 显示部署安装截止日期
- 列出缺少的补丁
醇>
获取所有缺失补丁的代码:
$Results = (get-wmiobject -ComputerName $env:ComputerName -query "SELECT * FROM CCM_UpdateStatus" -namespace "root\ccm\SoftwareUpdates\UpdatesStore" | Where-Object {$_.Status -eq "Missing"})
输出代码段:
__GENUS : 2
__CLASS : CCM_UpdateStatus
__SUPERCLASS :
__DYNASTY : CCM_UpdateStatus
__RELPATH : CCM_UpdateStatus.UniqueId="4ffd2339-7fa5-4716-b64e-78e3dce16d59"
__PROPERTY_COUNT : 15
__DERIVATION : {}
__SERVER : ………………………………
__NAMESPACE : ROOT\ccm\SoftwareUpdates\UpdatesStore
__PATH : \\………………………………\ROOT\ccm\SoftwareUpdates\UpdatesStore:CCM_UpdateStatus.UniqueId="4ffd2339-7fa5-4716-b64e-78e3dce16d59"
Article : 3178662
Bulletin :
ExcludeForStateReporting : False
Language :
ProductID : e6cf1350-c01b-414d-a61f-263d14d133b4
RevisionNumber : 200
ScanTime : 20180320184935.000000+000
Sources : {{7D052A75-2032-4F02-BAC9-9EDA4DBD58DE}}
SourceType : 2
SourceUniqueId : {7D052A75-2032-4F02-BAC9-9EDA4DBD58DE}
SourceVersion : 68
Status : Missing
Title : Update for Microsoft Office 2016 (KB3178662) 32-Bit Edition
UniqueId : 4ffd2339-7fa5-4716-b64e-78e3dce16d59
UpdateClassification : e6cf1350-c01b-414d-a61f-263d14d133b4
PSComputerName : WGC1107B87PH2
我无法确定如何获取修补程序关联的部署名称或修补程序安装部署截止日期。一旦我能得到这两个关联,我想输出如下所示:
Baseline Patch Deployment:
Install Deadline: Apr 12, 2018
Missing Patches:
Patch1
Patch2
Patch3
Office 2016 April Patch Deployment:
Install Deadline: Apr 27, 2018
Missing Patches:
Patch1
Patch2
Patch3
Missing but Unapproved Patches:
Install Deadline: None
Missing Patches
Patch1
Patch2
Patch3