Upgrade Windows Server 2008 R2 Enterprise to Windows Server 2012 R2 Standard

Before you begin, please take a Snapshot of your Virtual Machine or Server before proceeding. Also, this article assumes that all services, applications, databases, etc. have been prepared for the upgrade and respective downtime communications and notifications sent out.

Gather System Information

Open an elevated command prompt e.g. click Start, right-click Command Prompt, and then click Run as administrator.

Execute the following commands to gather system information before upgrade…

Get detailed configuration information:
C:>systeminfo

Get all current TCP/IP network configuration values:
C:>ipconfig /all

Get Flexible Single Master Operation Roles (FSMO) in Active Directory (AD):
C:>netdom query FSMO

(Optional) Disable driver signature enforcement [if needed] with the following BCDEdit command:
C:>bcdedit.exe /set nointegritychecks on

Re-enable integrity checks:
C:>bcdedit.exe /set nointegritychecks off

Product key script (Optional)

If you need the product key, here is an awesome script by Nedim Mehic to get it.

Open up a text editor and paste the following PowerShell function:

function Get-WindowsKey {
## function to retrieve the Windows Product Key from any PC
## by Nedim Mehic
param ($targets = “.”)
$hklm = 2147483650
$regPath = “Software\Microsoft\Windows NT\CurrentVersion”
$regValue = “DigitalProductId”
Foreach ($target in $targets) {
$productKey = $null
$win32os = $null
$wmi = [WMIClass]”\$target\root\default:stdRegProv”
$data = $wmi.GetBinaryValue($hklm,$regPath,$regValue)
$binArray = ($data.uValue)[52..66]
$charsArray = “B”,”C”,”D”,”F”,”G”,”H”,”J”,”K”,”M”,”P”,”Q”,”R”,”T”,”V”,”W”,”X”,”Y”,”2″,”3″,”4″,”6″,”7″,”8″,”9″
## decrypt base24 encoded binary data
For ($i = 24; $i -ge 0; $i–) {
$k = 0
For ($j = 14; $j -ge 0; $j–) {
$k = $k * 256 -bxor $binArray[$j]
$binArray[$j] = [math]::truncate($k / 24)
$k = $k % 24
}
$productKey = $charsArray[$k] + $productKey
If (($i % 5 -eq 0) -and ($i -ne 0)) {
$productKey = “-” + $productKey
}
}
$win32os = Get-WmiObject Win32_OperatingSystem -computer $target
$obj = New-Object Object
$obj | Add-Member Noteproperty Computer -value $target
$obj | Add-Member Noteproperty Caption -value $win32os.Caption
$obj | Add-Member Noteproperty CSDVersion -value $win32os.CSDVersion
$obj | Add-Member Noteproperty OSArch -value $win32os.OSArchitecture
$obj | Add-Member Noteproperty BuildNumber -value $win32os.BuildNumber
$obj | Add-Member Noteproperty RegisteredTo -value $win32os.RegisteredUser
$obj | Add-Member Noteproperty ProductID -value $win32os.SerialNumber
$obj | Add-Member Noteproperty ProductKey -value $productkey
$obj
}
}

*Save file as ProductKey.ps1

Open an elevated PowerShell window, and navigate to the saved location of your ProductKey.ps1 file.

Execute the following to set execution policy to RemoteSigned to execute *.ps1 scripts:
PS C:\ > Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Verify execution policy is set to RemoteSigned:
PS C:\ > Get-ExecutionPolicy

Execute the following command to get the key information:
PS C:\ > Import-Module C:\\ProductKey.ps1; Get-WindowsKey

Prepare Windows Server 2008 R2 Enterprise for Upgrade

Open an elevated command prompt e.g. click Start, right-click Command Prompt, and then click Run as administrator.

Verify there are no integrity violations on the system with the following command:
C:>sfc /scannow

Upgrade Windows Server 2008 R2 Enterprise

Mount Windows Server 2012 R2 Standard *.ISO Disk Image File with ImDisk Virtual Disk Driver [or preferred method].

Open an elevated command prompt e.g. click Start, right-click Command Prompt, and then click Run
as administrator
.

Set drive letter to mounted installation media.

For example, if the Disk Image File is mounted on the F Drive, execute the following command:
C:>F:

Command Prompt drive should be changed, and you can navigate
to Adprep.exe directory:

F:\>cd support\adprep

NOTE: The VM here was set to Windows2016Forest in vSphere Console prior to windows upgrade, and Adprep was not executed.

Check Forest and Domain functional levels.

PS C:\> Import-Module ActiveDirectory

PS C:\> Get-ADDomain | fl Name,DomainMode

PS C:\> Get-ADForest | fl Name,ForestMode

Extend the Active Directory® schema and update permissions as necessary to prepare a forest and domain for a domain controller that runs the Windows Server® 2008 operating system with Adprep.

Prepare a forest
for a domain controller that runs Windows Server 2008:

F:\support\adprep>adprep
/forestprep

Prepare domain
for a domain controller that runs Windows Server 2008:

F:\support\adprep>adprep
/domainprep

(Optional) Apply AD security and group-policy updates to the
domain:

F:\support\adprep>adprep /domainprep /gpprep

Install Windows Server 2012 R2 Standard

Open up vSphere Console, and navigate to VM.

Edit the CPUID Mask to Expose the NX/XD flag to guest

This is necessary for a remote upgrade.

Open windows explorer and find setup.exe in mounted Windows Server 2012 R2 Standard installation
package root directory.

Right click setup.exe and Run as administrator.

NOTE: If KMS Client Key (GVLK) is embedded in the ISO: the key will activate automatically once the server is joined to the domain. If the VM is joined to the domain already: it should activate via the KMS server as soon as it has network connectivity, in which case the license key is not needed.

Install Windows
Server 2012 R2 Standard (Server with a GUI)
.

Server will restart many times during the upgrade/installation process.

More reading: Microsoft Docs

    Leave Your Comment Here