0
我想幫助驗證從文件夾安裝的更新的狀態,以下是腳本。從文件夾安裝Windows更新並返回已安裝的狀態
# Specify the location of the *.msu files
$updatedir = "C:\install\hvpatches"
foreach ($msu in $msus)
{
write-host "Installing update $msu ..."
$fullname = $msu.fullname
# Need to wrap in quotes as folder path may contain spaces
$fullname = "`"" + $fullname + "`""
###
$files = Get-ChildItem $updatedir -Recurse
$msus = $files | ? {$_.extension -eq ".msu"}
# Specify the command line parameters for wusa.exe
$parameters = $fullname + " /quiet /norestart"
# Start wusa.exe and pass in the parameters
$install = [System.Diagnostics.Process]::Start("wusa",$parameters)
$install.WaitForExit()
write-host "Finished installing $msu"
}
更新從上面的腳本安裝了Windows,我想一些方法來驗證,如果這些更新的安裝是否正確,或給一個狀態,如果安裝失敗。
我希望我們的一些PowerShell的大師幫我:)
感謝, Vinith!