[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-nullOrnegin bu scriptte hangi updatelerin yuklendigi hakkinda bilge veren kismi cikartarak kendinize sadece bilgisayar isimlerinden olusan bir cikti hazirlayabilirsiniz de , ve bu ciktiyi SCOM/MOM gibi bir sunucuda Task tanimlayarak haftalik yeniden baslatma zamanlamasi yapabilirsiniz. Bunun icin
if (!$wsus) {
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();
}
$computerScope = new-object Microsoft.UpdateServices.Administration.ComputerTargetScope;
$computerScope.IncludedInstallationStates = [Microsoft.UpdateServices.Administration.UpdateInstallationStates]::InstalledPendingReboot;
$updateScope = new-object Microsoft.UpdateServices.Administration.UpdateScope;
$updateScope.IncludedInstallationStates = [Microsoft.UpdateServices.Administration.UpdateInstallationStates]::InstalledPendingReboot;
$computers = $wsus.GetComputerTargets($computerScope);
$computers | foreach-object {
$_.FullDomainName | write-host;
# Show which updates are causing the reboot required for the computer. Remove the next 5 lines to only generate a list of computers.
$updatesForReboot = $_.GetUpdateInstallationInfoPerUpdate($updateScope);
$updatesForReboot | foreach-object {
$neededUpdate = $wsus.GetUpdate($_.UpdateId);
" "+$neededUpdate.Title | write-host;
# Remove previous lines to only show computers that need updates
}
}
sadece bu kismini kullanmaniz yeterli olacaktir.
[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null
if (!$wsus) {
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();
}
$computerScope = new-object Microsoft.UpdateServices.Administration.ComputerTargetScope;
$computerScope.IncludedInstallationStates = [Microsoft.UpdateServices.Administration.UpdateInstallationStates]::InstalledPendingReboot;
$updateScope = new-object Microsoft.UpdateServices.Administration.UpdateScope;
$updateScope.IncludedInstallationStates = [Microsoft.UpdateServices.Administration.UpdateInstallationStates]::InstalledPendingReboot;
$computers = $wsus.GetComputerTargets($computerScope);
$computers | foreach-object {
$_.FullDomainName | write-host;
Bu bilginin kaynagi ve scripting hakkinda daha fazla bilgi icin Microsoft Script Center i siddetle tavsiye ederim.
No comments:
Post a Comment