# By sct@tc.edu.tw # 如果您想透過共用資料夾收集各電腦執行結果請修改下面UNC路徑,再把下面三行有#註解的#拿掉 # $outputfile="\\172.20.1.13\教師專區\檔案分享暫存區\patchlist.txt" Write-Output "開始檢查.......,請稍後!!!" $a=0 $hotfixidArray = "KB5005563","KB5005565","KB5005566","KB5005568","KB5005569","KB5005573","KB5005575","KB5005606","KB5005613","KB5005623","KB5005633","KB5005627" foreach ($hotfixid in $hotfixidArray) { if (get-hotfix -id $hotfixid -ea Ignore) { Write-Output $env:COMPUTERNAME"已經安裝$hotfixid,"完成漏洞修補 # Write-Output $env:COMPUTERNAME"已經安裝$hotfixid,"完成漏洞修補 | Out-File -Append $outputfile $a+=1 } } if ($a -eq 0) { Write-Output $env:COMPUTERNAME"未安裝漏洞修補套件" # Write-Output $env:COMPUTERNAME"未安裝漏洞修補套件" | Out-File -Append $outputfile } PAUSE