Delen via


WSUS en de Microsoft Update-catalogus

Van toepassing op: Windows Server 2025, Windows Server 2022, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012

De Microsoft Update-catalogus is een service die een lijst met updates biedt die kunnen worden gedistribueerd via een bedrijfsnetwerk. U kunt de catalogus gebruiken om informatie te vinden over Software-updates, stuurprogramma's en hotfixes van Microsoft. WSUS currently includes an option to Import Updates from the Microsoft Update Catalog. However, the Import Updates action in WSUS was built using ActiveX, which is now deprecated. Deze importfunctionaliteit in WSUS is vervangen door een PowerShell-script. Met het script kunt u één update of meerdere updates importeren in WSUS. Dit artikel bevat informatie over de catalogus, het importscript en het gebruik van het script.

Vereisten voor het importeren van updates in WSUS

De volgende vereisten zijn vereist voor het importeren van updates in WSUS met het PowerShell-script:

  • Elke computer waarop de WSUS-beheerconsole is geïnstalleerd, ongeacht of het een WSUS-server is, kan worden gebruikt om updates te importeren.
    • Wanneer u importeert vanaf een WSUS-server, gebruikt u een account dat lid is van de groep WSUS-beheerders of de groep Lokale beheerders.
    • Wanneer u importeert vanaf een externe computer, gebruikt u een account dat lid is van de groep WSUS-beheerders en beschikt u over beheerdersmachtigingen op de lokale computer. Externe computers moeten de WSUS-server via het netwerk kunnen bereiken.

De Microsoft Update-catalogus

Met de Microsoft Update-catalogus kunt u zoeken naar verschillende updatevelden en -categorieën. Deze updatevelden zijn onder andere:

  • Update title
  • Description
  • Applicable products
  • Classifications
  • Nummers van Knowledge Base-artikelen in het formaat van KB1234567

Wanneer u zoekt naar hardware-updates of stuurprogramma's, kunt u ook zoeken naar de volgende velden:

  • Driver model
  • Manufacturer
  • Class
  • De vierdelige hardware-id, zoals PCI\VEN_14E4&DEV_1677&SUBSYS_01AD1028.

U kunt het bereik van uw zoekopdracht beperken door extra zoektermen toe te voegen. Als u een specifieke tekenreeks wilt doorzoeken, gebruikt u dubbele aanhalingstekens.

Note

Met de catalogus kunt u ook updates rechtstreeks vanaf de site downloaden met behulp van de downloadknop. Echter, updates die op deze manier worden gedownload, hebben een .MSU-indeling. WSUS kan geen updates in .MSU indeling importeren. Dit bestandstype wordt vaak gebruikt door het zelfstandige installatieprogramma van Windows Update, DISM of andere hulpprogramma's voor updates. Voor sommige hulpprogramma's moet u de bestanden uit de .MSU bestanden extraheren voordat ze kunnen worden gebruikt.

Updates importeren in WSUS met behulp van PowerShell

Gebruik de onderstaande instructies om updates te importeren in WSUS:

  1. Kopieer het PowerShell-script om updates uit dit artikel in WSUS te importeren in een teksteditor en sla het op als ImportUpdateToWSUS.ps1. Gebruik een locatie die u gemakkelijk kunt openen, zoals C:\temp.

  2. Open de Microsoft Update-catalogus, https://catalog.update.microsoft.com, in een browser.

  3. Zoek naar een update die u wilt importeren in WSUS.

  4. Selecteer in de lijst met geretourneerde items de update die u wilt importeren in WSUS. De pagina met details van de update wordt geopend.

  5. Use the Copy button on the update details page to copy the UpdateID.

  6. Het script kan worden gebruikt om één update of meerdere updates te importeren.

    • Als u meerdere updates in WSUS wilt importeren, plakt u de update-id's voor elke update die u wilt importeren in een tekstbestand. Vermeld één update-id per regel en sla het tekstbestand op wanneer u klaar bent. Gebruik een locatie die u gemakkelijk kunt openen, zoals C:\temp\UpdateIDs.txt.
    • Als u één update wilt importeren, hoeft u alleen de enkele update-id te kopiëren.
  7. To import updates, open a PowerShell console as an administrator and run the script with the following syntax using any needed parameters:

    C:\temp\ImportUpdateToWSUS.ps1 [-WsusServer] <String> [-PortNumber] <Int32> [-UseSsl] [-UpdateId] <String> [-UpdateIdFilePath] <string> [<CommonParameters>]
    

    Example 1: While signed into a WSUS server that uses the default port, import a single update using the following syntax:

    .\ImportUpdateToWSUS.ps1 -UpdateId 12345678-90ab-cdef-1234-567890abcdef
    

    Example 2: Using a remote computer, import multiple updates into a WSUS server using SSL with the following syntax:

    .\ImportUpdateToWSUS.ps1 -WsusServer WSUSServer.contoso.com -PortNumber 8531 -UseSsl -UpdateIdFilePath C:\temp\UpdateIDs.txt
    
  8. The update files for updates that are imported are downloaded based on your Update files settings. Als u bijvoorbeeld de optie gebruikt om updatebestanden alleen naar deze server te downloaden wanneer updates zijn goedgekeurd, worden de updatebestanden gedownload wanneer de update is goedgekeurd. Zie sectie 1.3 Een WSUS-opslagstrategie kiezen voor meer informatie over opties voor het opslaan van updates.

PowerShell-script voor het importeren van updates in WSUS

<#
.SYNOPSIS
Powershell script to import an update, or multiple updates into WSUS based on the UpdateID from the catalog.

.DESCRIPTION
This script takes user input and attempts to connect to the WSUS server.
Then it tries to import the update using the provided UpdateID from the catalog.

.INPUTS
The script takes WSUS server Name/IP, WSUS server port, SSL configuration option and UpdateID as input. UpdateID can be viewed and copied from the update details page for any update in the catalog, https://catalog.update.microsoft.com. 

.OUTPUTS
Writes logging information to standard output.

.EXAMPLE
# Use with remote server IP, port and SSL
.\ImportUpdateToWSUS.ps1 -WsusServer 127.0.0.1 -PortNumber 8531 -UseSsl -UpdateId 12345678-90ab-cdef-1234-567890abcdef

.EXAMPLE
# Use with remote server Name, port and SSL
.\ImportUpdateToWSUS.ps1 -WsusServer WSUSServer1.us.contoso.com -PortNumber 8531 -UseSsl -UpdateId 12345678-90ab-cdef-1234-567890abcdef

.EXAMPLE
# Use with remote server IP, defaultport and no SSL
.\ImportUpdateToWSUS.ps1 -WsusServer 127.0.0.1  -UpdateId 12345678-90ab-cdef-1234-567890abcdef

.EXAMPLE
# Use with localhost default port
.\ImportUpdateToWSUS.ps1 -UpdateId 12345678-90ab-cdef-1234-567890abcdef

.EXAMPLE
# Use with localhost default port, file with updateID's
.\ImportUpdateToWSUS.ps1 -UpdateIdFilePath .\file.txt


.NOTES  
# On error, try enabling TLS: https://learn.microsoft.com/mem/configmgr/core/plan-design/security/enable-tls-1-2-client

# Sample registry add for the WSUS server from command line. Restarts the WSUSService and IIS after adding:
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /V SchUseStrongCrypto /T REG_DWORD /D 1

## Sample registry add for the WSUS server from PowerShell. Restarts WSUSService and IIS after adding:
$registryPath = "HKLM:\Software\Microsoft\.NETFramework\v4.0.30319"
$Name = "SchUseStrongCrypto"
$value = "1" 
if (!(Test-Path $registryPath)) {
    New-Item -Path $registryPath -Force | Out-Null
}
New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null
Restart-Service WsusService, w3svc

# Update import logs/errors are under %ProgramFiles%\Update Services\LogFiles\SoftwareDistribution.log

#>

param(
    [Parameter(Mandatory = $false, HelpMessage = "Specifies the name of a WSUS server, if not specified connects to localhost")]
    # Specifies the name of a WSUS server, if not specified connects to localhost.
    [string]$WsusServer,

    [Parameter(Mandatory = $false, HelpMessage = "Specifies the port number to use to communicate with the upstream WSUS server, default is 8530")]
    # Specifies the port number to use to communicate with the upstream WSUS server, default is 8530.
    [ValidateSet("80", "443", "8530", "8531")]
    [int32]$PortNumber = 8530,

    [Parameter(Mandatory = $false, HelpMessage = "Specifies that the WSUS server should use Secure Sockets Layer (SSL) via HTTPS to communicate with an upstream server")]
    # Specifies that the WSUS server should use Secure Sockets Layer (SSL) via HTTPS to communicate with an upstream server.  
    [Switch]$UseSsl,

    [Parameter(Mandatory = $true, HelpMessage = "Specifies the update Id we should import to WSUS", ParameterSetName = "Single")]
    # Specifies the update Id we should import to WSUS
    [ValidateNotNullOrEmpty()]
    [String]$UpdateId,

    [Parameter(Mandatory = $true, HelpMessage = "Specifies path to a text file containing a list of update ID's on each line", ParameterSetName = "Multiple")]
    # Specifies path to a text file containing a list of update ID's on each line.
    [ValidateNotNullOrEmpty()]
    [String]$UpdateIdFilePath
)

Set-StrictMode -Version Latest

# set server options
$serverOptions = "Get-WsusServer"
if ($psBoundParameters.containsKey('WsusServer')) { $serverOptions += " -Name $WsusServer -PortNumber $PortNumber" }
if ($UseSsl) { $serverOptions += " -UseSsl" }

# empty updateID list
$updateList = @()

# get update id's
if ($UpdateIdFilePath) {
    if (Test-Path $UpdateIdFilePath) {
        foreach ($id in (Get-Content $UpdateIdFilePath)) {
            $updateList += $id.Trim()
        }
    }
    else {
        Write-Error "[$UpdateIdFilePath]: File not found"
		return
    }
}
else {
    $updateList = @($UpdateId)
}

# get WSUS server
Try {
    Write-Host "Attempting WSUS Connection using $serverOptions... " -NoNewline
    $server = invoke-expression $serverOptions
    Write-Host "Connection Successful"
}
Catch {
    Write-Error $_
    return
}

# empty file list
$FileList = @()

# call ImportUpdateFromCatalogSite on WSUS
foreach ($uid in $updateList) {
    Try {
        Write-Host "Attempting WSUS update import for Update ID: $uid... " -NoNewline
        $server.ImportUpdateFromCatalogSite($uid, $FileList)
        Write-Host "Import Successful"
    }
    Catch {
        Write-Error "Failed. $_"
    }
}

Script parameters

WsusServer: <string>
Specifies the name of a WSUS server. Als dit niet is opgegeven, maakt het script verbinding met localhost.

  • Required: false
  • Default value: localhost

PortNumber: <Int32>
Specifies the port number to use to communicate with the upstream WSUS server.

  • Required: false
  • Default value: 8530
  • Allowed values: 80, 443, 8530, 8531

UseSsl: <switch>
Specifies if Secure Sockets Layer (SSL) via HTTPS should be used to communicate with the WSUS server. Als deze parameternaam aanwezig is, worden de parametertests $true uitgevoerd en wordt de verbinding met de WSUS-server gemaakt met behulp van SSL, anders. false When using the USeSSL parameter, set the PortNumber to either 443 or 8531.

  • Required: false

UpdateId: <string>
Specifies the update ID you want to import to WSUS. Deze parameter is vereist als u één update importeert. UpdateId can't be used with UpdateIdFilePath.

  • Required: true, when importing a single updateID specified as a script parameter

UpdateIdFilePath: <string>
Specifies the path to a text file containing a list of update IDs on each line. Deze parameter is vereist als u meerdere updates importeert. UpdateIdFilePath can't be used with UpdateId.

  • Required: true, when using a text file to import multiple updates

CommonParameters:
Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see About CommonParameters

Toegang tot hotfixes beperken

WSUS-beheerders kunnen overwegen de toegang te beperken tot de hotfixes die ze hebben gedownload uit de Microsoft Update-catalogus. Voer de volgende stappen uit om de beschikbare hotfixes te beperken:

  1. Start de IIS-beheerconsole (Internet Information Services).
  2. Navigate to the Content node under WSUS Administration web site.
  3. On the Content Home pane, double-click in the Authentication option.
  4. Select Anonymous Authentication and select Disable in the Actions pane on the right.
  5. Select Windows Authentication and select Enable in the Actions pane on the right.
  6. Maak in de WSUS-beheerconsole een WSUS-doelgroep voor de computers die de hotfix nodig hebben en voeg deze toe aan de groep. Zie Wsus-clientcomputers en WSUS-computergroepen in deze handleiding beheren en WSUS-computergroepen configureren in de WSUS-implementatiehandleiding voor meer informatie over computers en groepen.
  7. Download de bestanden voor de hotfix.
  8. Stel de machtigingen van deze bestanden in, zodat alleen computeraccounts van die computers deze kunnen lezen. U moet ook volledige toegang tot de bestanden toestaan voor het netwerkserviceaccount.
  9. Keur de hotfix goed voor de WSUS-doelgroep die in stap 2 is aangemaakt.

Note

You can remove updates that are imported from the Microsoft Update Catalog that are set as either Not Approved or Declined, by running the WSUS Server cleanup Wizard. U kunt updates die eerder zijn verwijderd uit uw WSUS-systemen, opnieuw importeren.

Updates importeren in verschillende talen

De catalogus bevat updates die ondersteuning bieden voor meerdere talen.

Important

Stem de talen die worden ondersteund door de WSUS-server af op de talen die worden ondersteund door de geïmporteerde updates.

Als de WSUS-server niet alle talen in de update ondersteunt, wordt de update niet geïmplementeerd op clientcomputers. Als een update die meerdere talen ondersteunt, is gedownload naar de WSUS-server, maar nog niet is geïmplementeerd op clientcomputers en een beheerder deselecteert een van de talen die zijn opgenomen in de update, wordt de update niet geïmplementeerd op de clients.

Troubleshooting

De sectie ".NOTES" van het script kan worden gebruikt voor het oplossen van problemen die kunnen optreden bij het uitvoeren van het script.

  • Als er een fout optreedt, kunt u Transport Layer Security (TLS) 1.2 inschakelen. Zie TLS 1.2 inschakelen op clients voor meer informatie

  • U kunt de volgende opdracht gebruiken om het proces van het toevoegen van een registerwaarde gerelateerd aan het gebruik van sterke crypto te automatiseren. Start de Windows Server Update Services-service en de World Wide Web Publishing-service handmatig opnieuw op nadat u de registerwaarde hebt toegevoegd.

    reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /V SchUseStrongCrypto /T REG_DWORD /D 1
    
  • Voer dit PowerShell-script uit om het proces voor het toevoegen van een registerwaarde met betrekking tot het gebruik van sterke crypto te automatiseren en de Windows Server Update Services-service en de World Wide Web Publishing-service opnieuw te starten:

    $registryPath = "HKLM:\Software\Microsoft\.NETFramework\v4.0.30319"
    $Name = "SchUseStrongCrypto"
    $value = "1"
    if (!(Test-Path $registryPath)) {
       New-Item -Path $registryPath -Force | Out-Null
    }
    New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null
    Restart-Service WsusService, w3svc
    
  • Activity and/or errors related to importing updates can be found in %ProgramFiles%\Update Services\LogFiles\SoftwareDistribution.log of the WSUS server where updates are being imported.