Come determinare gli aggiornamenti della sicurezza e gli aggiornamenti rapidi di .NET Framework installati

Questo articolo illustra come trovare gli aggiornamenti della sicurezza e gli aggiornamenti rapidi di .NET Framework installati in un computer.

Cronologia degli aggiornamenti

Per vedere quali aggiornamenti .NET Framework sono installati sul tuo computer, nelle Impostazioni, passare a Windows Update>Cronologia degli aggiornamenti. Consultare la sezione Aggiornamenti qualitativi per gli aggiornamenti .NET Framework. Ad esempio, si potrebbe vedere un aggiornamento simile ad "Aggiornamento cumulativi 11-2023 per .NET Framework 3.5 e 4.8.1 per Windows 11, versione 22H2 per x64 (KB5032007)".

Registro

È possibile eseguire una query sul registro usando Editor registro, codice o PowerShell.

Nota

Tutte le tecniche del registro richiedono un account con privilegi amministrativi.

Usare l'Editor del Registro di sistema

Gli aggiornamenti della sicurezza e gli aggiornamenti rapidi installati per ogni versione di .NET Framework installata in un computer sono elencati nel Registro di sistema di Windows. Per visualizzare queste informazioni, è possibile usare il programma Editor del Registro di sistema (regedit.exe).

  1. Aprire il programma regedit.exe. In Windows 8 e versioni successive, fare clic con il pulsante destro del mouse su StartScreenshot del logo del tasto WINDOWS., quindi scegliere Esegui. Nella casella Apri immettere regedit e fare clic su OK.

  2. Nell'Editor del Registro di sistema aprire la seguente sottochiave:

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Updates

    Gli aggiornamenti installati sono elencati nelle sottochiavi che identificano la versione di .NET Framework a che si applicano. Ogni aggiornamento è identificato da un numero di Knowledge Base (KB).

Nell'Editor del Registro di sistema le versioni di .NET Framework e gli aggiornamenti installati per ogni versione sono archiviati in sottochiavi diverse. Per informazioni sul rilevamento dei numeri delle versioni installate, vedere Procedura: Determinare le versioni di .NET Framework installate.

Query con codice

L'esempio seguente consente di determinare gli aggiornamenti della sicurezza e gli aggiornamenti rapidi di .NET Framework installati in un computer a livello di codice:

using System;
using Microsoft.Win32;

public class GetUpdateHistory
{
    public static void Main()
    {
        using (RegistryKey baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(@"SOFTWARE\Microsoft\Updates"))
        {
            foreach (string baseKeyName in baseKey.GetSubKeyNames())
            {
                if (baseKeyName.Contains(".NET Framework"))
                {
                    using (RegistryKey updateKey = baseKey.OpenSubKey(baseKeyName))
                    {
                        Console.WriteLine(baseKeyName);
                        foreach (string kbKeyName in updateKey.GetSubKeyNames())
                        {
                            using (RegistryKey kbKey = updateKey.OpenSubKey(kbKeyName))
                            {
                                Console.WriteLine("  " + kbKeyName);
                            }
                        }
                    }
                }
            }
        }
    }
}

Imports Microsoft.Win32

Public Class GetUpdateHistory
    Public Shared Sub Main()
        Using baseKey As RegistryKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey("SOFTWARE\Microsoft\Updates")
            For Each baseKeyName As String In baseKey.GetSubKeyNames()
                If baseKeyName.Contains(".NET Framework") Then
                    Using updateKey As RegistryKey = baseKey.OpenSubKey(baseKeyName)
                        Console.WriteLine(baseKeyName)
                        For Each kbKeyName As String In updateKey.GetSubKeyNames()
                            Using kbKey As RegistryKey = updateKey.OpenSubKey(kbKeyName)
                                Console.WriteLine("  " & kbKeyName)
                            End Using
                        Next
                    End Using
                End If
            Next
        End Using
    End Sub
End Class

In questo esempio viene generato un output simile al seguente:

Microsoft .NET Framework 4 Client Profile
  KB2468871
  KB2468871v2
  KB2478063
  KB2533523
  KB2544514
  KB2600211
  KB2600217
Microsoft .NET Framework 4 Extended
  KB2468871
  KB2468871v2
  KB2478063
  KB2533523
  KB2544514
  KB2600211
  KB2600217

Query con PowerShell

L'esempio seguente illustra come determinare gli aggiornamenti della sicurezza e gli aggiornamenti rapidi di .NET Framework installati in un computer usando PowerShell:

$DotNetVersions = Get-ChildItem HKLM:\SOFTWARE\WOW6432Node\Microsoft\Updates | Where-Object {$_.name -like
 "*.NET Framework*"}

ForEach($Version in $DotNetVersions){

   $Updates = Get-ChildItem $Version.PSPath
    $Version.PSChildName
    ForEach ($Update in $Updates){
       $Update.PSChildName
       }
}

In questo esempio viene generato un output simile al seguente:

Microsoft .NET Framework 4 Client Profile
KB2468871
KB2468871v2
KB2478063
KB2533523
KB2544514
KB2600211
KB2600217
Microsoft .NET Framework 4 Extended
KB2468871
KB2468871v2
KB2478063
KB2533523
KB2544514
KB2600211
KB2600217

Vedi anche