When managing thousands of Windows Server 2012 R2 instances that need upgrading from Standard to Datacenter edition, manual intervention for reboot confirmation becomes completely impractical. The standard DISM command presents this prompt:
Image version: 6.3.9600.16384
The operation completed successfully.
Restart the computer to complete this operation.
Do you want to restart the computer now? (Y/N)
Here's the complete command sequence that handles the entire process without any user interaction:
DISM /online /Set-Edition:ServerDatacenter /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula /NoRestart
shutdown /r /t 60 /c "Automated server edition upgrade reboot"
The key components that make this work:
- /NoRestart: Prevents DISM from asking about immediate reboot
- Separate shutdown command: Gives control over the reboot timing
- 60-second delay (/t 60): Allows running processes to complete gracefully
For large-scale deployments, consider this PowerShell script that adds logging and verification:
# ServerUpgradeAutomation.ps1
$LogFile = "C:\UpgradeLogs\$($env:COMPUTERNAME)_$(Get-Date -Format 'yyyyMMdd').log"
$ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
Start-Transcript -Path $LogFile -Append
try {
Write-Output "Starting edition upgrade process"
$DISMProcess = Start-Process -FilePath "DISM.exe" -ArgumentList @(
"/online",
"/Set-Edition:ServerDatacenter",
"/ProductKey:$ProductKey",
"/AcceptEula",
"/NoRestart",
"/English"
) -Wait -PassThru
if ($DISMProcess.ExitCode -eq 0) {
Write-Output "DISM operation completed successfully"
Start-Process -FilePath "shutdown.exe" -ArgumentList @(
"/r",
"/t 300",
"/c ""Automated reboot after edition upgrade"""
)
} else {
Write-Error "DISM failed with exit code $($DISMProcess.ExitCode)"
}
}
catch {
Write-Error "Upgrade failed: $_"
}
finally {
Stop-Transcript
}
When implementing this solution across your infrastructure:
- Test thoroughly in a non-production environment first
- Ensure you have proper backups before mass deployment
- Consider using configuration management tools (Ansible, Chef, Puppet) for orchestration
- Monitor disk space - the upgrade process requires significant temporary storage
If you're managing hybrid environments, these methods might be preferable:
- WSUS Offline Updates: For air-gapped networks
- DISM with answer files: For completely hands-off installations
- Azure Automation: For cloud-connected servers
When upgrading Windows Server 2012 R2 from Standard to Datacenter edition using DISM, the operation typically requires manual confirmation for reboot:
DISM /online /Set-Edition:ServerDatacenter /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula
This becomes problematic when dealing with large-scale deployments across thousands of servers.
DISM provides several parameters for unattended operations:
DISM /online /Set-Edition:ServerDatacenter /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula /Quiet /NoRestart
Key parameters:
- /Quiet - Suppresses all output
- /NoRestart - Prevents automatic reboot (though doesn't suppress the prompt)
For fully automated execution, combine DISM with PowerShell and scheduled tasks:
Start-Process -FilePath "DISM.exe" -ArgumentList "/online /Set-Edition:ServerDatacenter /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula /Quiet /NoRestart" -Wait -NoNewWindow
Then handle the reboot separately using:
shutdown /r /t 60 /c "Automated reboot after edition upgrade"
Create an XML answer file (unattend.xml):
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="generalize">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<EditionUpgrade>
<WillShowUI>Never</WillShowUI>
<TargetEdition>ServerDatacenter</TargetEdition>
<ProductKey>XXXXX-XXXXX-XXXXX-XXXXX-XXXXX</ProductKey>
</EditionUpgrade>
</component>
</settings>
</unattend>
Execute with:
DISM /online /Apply-Unattend:"C:\unattend.xml"
After execution, verify success with:
Get-WmiObject -Class Win32_OperatingSystem | Select-Object Caption
For robust automation, implement error checking:
try {
$process = Start-Process DISM -ArgumentList @("/online", "/Set-Edition:ServerDatacenter", "/ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX", "/AcceptEula", "/Quiet", "/NoRestart") -PassThru -Wait -NoNewWindow
if ($process.ExitCode -ne 0) {
throw "DISM failed with exit code $($process.ExitCode)"
}
Write-Output "Edition upgrade completed successfully"
}
catch {
Write-Error $_.Exception.Message
}