How to Apply Windows Updates on Hyper-V Server 2012 Core Edition via PowerShell


2 views

The free Hyper-V Server 2012 is indeed based on Windows Server 2012 Core edition, but with the GUI completely removed. Unlike the standard Server Core installation, this version is specifically optimized for virtualization workloads. The absence of GUI components means all administration must be done through command-line tools.

First, verify whether Windows Update is already configured and check available updates:

# List all available updates
Get-WindowsUpdate -NotCategory "Drivers"

# Check update history
Get-WindowsUpdate -History

# View current update settings
Get-WUInstall -WindowsUpdate

Since Server Core lacks the traditional Windows Update interface, we need to configure it via PowerShell:

# Install Windows Update module if not present
Import-Module PSWindowsUpdate

# Set automatic update behavior (recommended for servers)
Set-WUSettings -AcceptAll -AutoInstall -AutoReboot -NotificationLevel Full

# Alternatively for manual control:
Set-WUSettings -ManualDownload -NotifyDownload -NotifyInstall

For specific Hyper-V related hotfixes, you can target them directly:

# Install all available updates (general approach)
Install-WindowsUpdate -AcceptAll -AutoReboot

# For specific KB updates (example KB2919355)
Get-WindowsUpdate -KBArticleID "KB2919355" | Install-WindowsUpdate

Server Core installations often require reboots after updates. Here's how to manage them:

# Check if reboot is pending
Test-PendingReboot

# Schedule reboot after updates (example: 10 minutes)
Install-WindowsUpdate -AcceptAll -AutoReboot -AutoRebootTime (Get-Date).AddMinutes(10)

For cluster environments, consider creating a scheduled task:

# Create weekly update task
$trigger = New-JobTrigger -Weekly -At "3:00 AM" -DaysOfWeek Sunday
Register-ScheduledJob -Name "WeeklyUpdates" -ScriptBlock {
    Import-Module PSWindowsUpdate
    Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot
} -Trigger $trigger

If updates fail, check the Windows Update log:

# View update logs
Get-WindowsUpdateLog -LogPath "C:\Windows\WindowsUpdate.log"

# Reset Windows Update components
net stop wuauserv
net stop cryptSvc
net stop bits
net stop msiserver
ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
net start wuauserv
net start cryptSvc
net start bits
net start msiserver

For cluster environments, stagger updates across nodes:

# Example cluster-aware update script
$nodes = Get-ClusterNode
foreach ($node in $nodes) {
    Move-ClusterVirtualMachineRole -Name $node.Name -MigrationType Live
    Invoke-Command -ComputerName $node.Name -ScriptBlock {
        Install-WindowsUpdate -AcceptAll -AutoReboot
    }
    while ((Test-PendingReboot -ComputerName $node.Name)) {
        Start-Sleep -Seconds 60
    }
}

Unlike its Windows Server counterpart, Hyper-V Server 2012 (the free standalone version) uses a Core installation without GUI components. The update process requires PowerShell commands since there's no Windows Update GUI or Server Manager integration.

First establish a remote PowerShell session:

Enter-PSSession -ComputerName HVServer1 -Credential (Get-Credential)

Check available updates:

Get-WindowsUpdate -MicrosoftUpdate -NotCategory "Drivers"

For specific Hyper-V hotfixes (like KB2919355), download the .msu package and install via:

wusa.exe X:\\path\\KB2919355.msu /quiet /norestart

For clusters, create a PowerShell script to iterate through nodes:

$ClusterNodes = Get-ClusterNode -Cluster HVCluster
foreach ($node in $ClusterNodes) {
    Invoke-Command -ComputerName $node -ScriptBlock {
        Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot
    }
}

Configure WSUS client settings via registry:

New-ItemProperty -Path "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate" 
-Name "WUServer" -Value "http://wsus.example.com:8530" -PropertyType String
New-ItemProperty -Path "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate" 
-Name "WUStatusServer" -Value "http://wsus.example.com:8530" -PropertyType String

Verify installed updates with:

Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 10