我需要在此脚本中显示更多信息,例如SO版本
foreach($vc in Import-Csv $lanzadera){
#Write-Host "$($vc.serverNameCLI)"
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $user,$pass
Invoke-Command -ComputerName $vc.serverNameCLI -Credential $cred -ErrorAction SilentlyContinue -ErrorVariable Problem {
##this variable $ssoo is the one i like to add
$ssoo = (Get-WmiObject -Class Win32_OperatingSystem).caption
$Patches = 'KB4457984', 'KB4463104', 'KB4467700',#Server 2008 sep,oct,nov
'KB4343899', 'KB4457145', 'KB4462915', 'KB4467106', #Server 2008 R2 ago,sep,oct,nov
'KB4343896', 'KB4457140', 'KB4462931', 'KB4467678', #Server 2012 ago,sep,oct,nov
'KB4343888', 'KB4457143', 'KB4462941', 'KB4467703', #Server 2012 R2 ago,sep,oct,nov
'KB4343887', 'KB4457131', 'KB4462917', 'KB4467691' #Server 2016 ago,sep,oct,nov
Get-HotFix -Id $Patches
}
foreach ($p in $Problem) {
if ($p.origininfo.pscomputername) {
Write-Warning -Message "Patch not found on $($p.origininfo.pscomputername)"
}
elseif ($p.targetobject) {
Write-Warning -Message "Unable to connect to $($p.targetobject)"
}
}
}
控制台中的输出如下:
Source Description HotFixID InstalledBy InstalledOn PSComputerName
------ ----------- -------- ----------- ----------- --------------
server00001 Security Update KB4343899 server00001\sysieci 10/02/2018 0:00:00 server00001
server00002 Security Update KB4457145 server00002\sysieci 10/02/2018 0:00:00 server00002
那么,如何使用Get-Hotfix命令添加更多的列/对象? 预先感谢