Tinus EngOps Wiki

Logo

OpsaC - Operating as PowerShell code

Links

Home

IT-Wiki

PowerShell Blog

PowerShell Index

PowerShell Search

Additional Websites

View my GitHub Profile

View my GitHub Gists

View my Codeberg Page

View my Photo Website

Windows Update Service

published: July 27, 2017 author: Tinu tags: Security - Windows Server - Windows Update Service categories: Windows Server


Assembly

Lädt eine Assembly aus dem Anwendungsverzeichnis oder dem globalen Assemblycache.

[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")

Microsoft.UpdateServices.Administration Namespace

Downstreamserver auflisten

$Upstreamserver = "$($env:COMPUTERNAME).$($env:USERDNSDOMAIN)"
$ret = @()
[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($Upstreamserver,$false, 8530)
$wsus.GetDownstreamServers() | %{
    $obj = [PSCustomObject]@{
        UpdateServer              = $_.UpdateServer
        DownstreamServer          = $_.FullDomainName
        LastSyncTime              = $_.LastSyncTime
        ParentServerId            = $_.ParentServerId
        SyncsFromDownstreamServer = $_.SyncsFromDownstreamServer
        LastRollupTime            = $_.LastRollupTime
        Version                   = $_.Version
        IsReplica                 = $_.IsReplica
    }
    $ret += $obj
}
$ret | ft

Cmdlets Windows Server 2012 R2

Get-Command -Module UpdateServices

Add-WsusComputer
Approve-WsusUpdate
Deny-WsusUpdate
Get-WsusClassification
Get-WsusComputer
Get-WsusProduct
Get-WsusServer
Get-WsusUpdate
Invoke-WsusServerCleanup
Set-WsusClassification
Set-WsusProduct
Set-WsusServerSynchronization

Invoke-WSUSServerCleanup

Get-WsusServer | Invoke-WsusServerCleanup -CleanupObsoleteComputers –CleanupObsoleteUpdates

Alle Computer Gruppen auflisten

[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") 
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer() 
$ret  = @()
foreach( $group in $wsus.GetComputerTargetGroups() ) 
{ 
    $obj = [PSCustomObject]@{
        Group = $group.Name
        Members = $group.GetComputerTargets().Count
    }
    $ret += $obj
} 
$ret | Sort Group | ft -AutoSize

← Previous Post ◇ [ Top ] ◇ Copyright © 2024 by tinuwalther ◇ [ Blog ] ◇ Next Post →