Clean-up on script_install_updates.ps1
This commit is contained in:
parent
4f93611834
commit
c405bdb54e
@ -33,7 +33,7 @@ Write-Host "Available Updates:"
|
|||||||
$updateNames = $updates | Select -ExpandProperty Name
|
$updateNames = $updates | Select -ExpandProperty Name
|
||||||
|
|
||||||
# display numbered list of update names
|
# display numbered list of update names
|
||||||
foreach($updateName in $updateNames) {
|
ForEach($updateName in $updateNames) {
|
||||||
Write-Host $updateName
|
Write-Host $updateName
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ $failedUpdates = @()
|
|||||||
|
|
||||||
# formats updates by just getting those that are required (ComplianceState=0). Converts updates to WMI so that they can be installed.
|
# formats updates by just getting those that are required (ComplianceState=0). Converts updates to WMI so that they can be installed.
|
||||||
ForEach ( $update in $updates ) {
|
ForEach ( $update in $updates ) {
|
||||||
$f_update = @($update | ForEach-Object {if($_.ComplianceState -eq 0){[WMI]$_.__PATH}})
|
$f_update = @($update | ForEach-Object { if($_.ComplianceState -eq 0){[WMI]$_.__PATH} })
|
||||||
$installName = $update | Select Name
|
$installName = $update | Select Name
|
||||||
|
|
||||||
# Installs updates
|
# Installs updates
|
||||||
@ -71,7 +71,7 @@ ForEach ( $update in $updates ) {
|
|||||||
If ( $eval_state -eq "13") {
|
If ( $eval_state -eq "13") {
|
||||||
$failedUpdates += $f_install_name
|
$failedUpdates += $f_install_name
|
||||||
} Else {
|
} Else {
|
||||||
Write-Host "Success: $f_install_name" -foregroundcolor green
|
Write-Host "Success: $f_install_name" -ForegroundColor green
|
||||||
$reboot = $True
|
$reboot = $True
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ If ( $failedUpdates -ne $Null ) {
|
|||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "Failed Updates:"
|
Write-Host "Failed Updates:"
|
||||||
ForEach ($failedUpdate in $failedUpdates) {
|
ForEach ($failedUpdate in $failedUpdates) {
|
||||||
Write-Host $failedUpdate -foregroundcolor red
|
Write-Host $failedUpdate -ForegroundColor red
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user