Bu Blogda Ara

MS WSUS - Güncellemeleri toplu olarak onaylama (approve) powershell scripti

Bu makalemizde, Wsus güncellemelerini powershell script ile nasıl toplu olarak onaylayabileceğimizi (approve) göreceğiz:

1) Tüm security ve critical update'leri tüm bilgisayarlar için approve etmek için: 

all_sec_and_crt_approve.ps1:

Write-Progress -Activity 'Tum security updates ler bulunuyor..' -PercentComplete 0
$updatesneeded = Get-WsusUpdate -Classification Security -Approval AnyExceptDeclined -Status any
$i = 0
$total = $updatesneeded.Count
foreach ($update in $updatesneeded)
{
  Write-Progress -Activity 'Tum security updates ler onaylaniyor.. ' -Status "$($update.Update.Title)" -PercentComplete (($i/$total) * 100)
  Approve-WsusUpdate -Update $update -Action Install -TargetGroupName 'all computers'
  $i++
}
Write-Host "Toplam onaylanan security update: $total" -ForegroundColor Yellow


Write-Progress -Activity 'Tum critical updates ler bulunuyor..' -PercentComplete 0
$updatesneeded2 = Get-WsusUpdate -Classification Critical -Approval AnyExceptDeclined -Status any
$i = 0
$total = $updatesneeded2.Count
foreach ($update in $updatesneeded2)
{
  Write-Progress -Activity 'Tum critical updates ler onaylaniyor.....' -Status "$($update.Update.Title)" -PercentComplete (($i/$total) * 100)
  Approve-WsusUpdate -Update $update -Action Install -TargetGroupName 'all computers'
  $i++
}
Write-Host "Toplam onaylanan critical update: $total" -ForegroundColor Yellow

2) Unapproved durumdaki security ve critical update'leri tüm bilgisayarlar için approve etmek için 

unapproved_sec_and_crt_approve.ps1:

Write-Progress -Activity 'Onaylanmamis security update ler bulunuyor...' -PercentComplete 0
$updatesneeded = Get-WsusUpdate -Classification Security -Approval Unapproved -Status any
$i = 0
$total = $updatesneeded.Count
foreach ($update in $updatesneeded)
{
  Write-Progress -Activity 'Onaylanmamis security update ler onaylaniyor...' -Status "$($update.Update.Title)" -PercentComplete (($i/$total) * 100)
  Approve-WsusUpdate -Update $update -Action Install -TargetGroupName 'all computers'
  $i++
}
Write-Host "Toplam onaylanan security update: $total" -ForegroundColor Yellow

Write-Progress -Activity 'Onaylanmamis critical update ler bulunuyor...' -PercentComplete 0
$updatesneeded2 = Get-WsusUpdate -Classification Critical -Approval Unapproved -Status any
$i = 0
$total = $updatesneeded2.Count
foreach ($update in $updatesneeded2)
{
  Write-Progress -Activity 'Onaylanmamis critical update ler onaylaniyor...' -Status "$($update.Update.Title)" -PercentComplete (($i/$total) * 100)
  Approve-WsusUpdate -Update $update -Action Install -TargetGroupName 'all computers'
  $i++
}
Write-Host "Toplam onaylanan critical update: $total" -ForegroundColor Yellow  

3) Tüm update'leri approve etmek için:

approve_all_updates_for_a_group.ps1:

Write-Progress -Activity 'Tum updateler bulunuyor...' -PercentComplete 0
$updatesneeded = Get-WsusUpdate -Classification All -Approval AnyExceptDeclined -Status any
$i = 0
$total = $updatesneeded.Count
foreach ($update in $updatesneeded)
{
  Write-Progress -Activity 'Tum update ler onaylaniyor...' -Status "$($update.Update.Title)" -PercentComplete (($i/$total) * 100)
  Approve-WsusUpdate -Update $update -Action Install -TargetGroupName 'Kat-7' (kat-7 grubundaki bilgisayarlar için approve ediyoruz.)
  $i++
}
Write-Host "Onaylanan update: $total" -ForegroundColor Yellow

Hiç yorum yok:

Yorum Gönder