Upgrading to a higher edition (SKU) of Windows 7/Windows Server 2008 R2 using DISM

The Deployment Image Servicing and Management (DISM) tool is a new tool included with Windows 7 and Windows Server 2008 R2. DISM enumerates, installs, uninstalls, configures, and updates features in Windows images, in either WIM or VHD format. DISM can also work against online (running) instances. Of special interest for this post are the editions commands; Get-CurrentEdition, Set-Edition, Get-TargetEditions, and their side-kick Set-ProductKey. With these you can upgrade a Windows instance from the command line without access to media. For Windows 7 and Windows Server 2008 R2 all the bits for higher editions are present in the instance or image. This is great news, because with previous versions of Windows you had to pop in the media, usually a CD/DVD, and perform an upgrade manually. For offline images (WIM/VHD) this is supported for both Windows 7 and Windows Server 2008 R2. But for running instances, or online, it is only supported for Windows Server, and only if the server is not a DC.

  1. Find the current edition for a running instance (online):
    dism.exe /online /Get-CurrentEdition
  2. Find the current edition for an offline image:
    dism.exe /image:c:mounted_image /Get-CurrentEdition
  3. Find the valid target editions for a running instance (online):
    dism.exe /online /Get-TargetEditions
  4. Find the valid target editions for an offline image:
    dism.exe /image:c:mounted_image /Get-TargetEditions
  5. Upgrade a running instance (online):
    dism.exe /online /Set-Edition:”ServerDatacenter” /ProductKey:AAAAA-BBBBB-CCCCC-DDDDD-EEEEE
  6. Upgrade an offline image:
    dism.exe /image:c:mounted_image /Set-Edition:”Professional” /ProductKey:AAAAA-BBBBB-CCCCC-DDDDD-EEEEE

When using Set-Edition, the parameter ProductKey is also required. Note that ProductKey in this case is a parameter for Set-Edition and not the Set-ProductKey command. Set-ProductKey can only be used against the current running instance and against offline instances. (If you do not have a product key, you can use the KMS key for the edition you are upgrading to. This will, of course, not get you a free license or anything, but it is convenient for testing. Find the KMS keys here.) For offline images it is also important to note that the images has to be generalized before you can upgrade it. Use sysprep.exe /generalize to do this.

Transcript of the upgrading of a VHD file:

C:Usersadministrator>diskpart

Microsoft DiskPart version 6.1.7600
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: HOME-HYPERV

DISKPART> select vdisk file=E:Hyper-Vlab-w2k8r2quicktestlab-w2k8r2quicktest.vhd

DiskPart successfully selected the virtual disk file.

DISKPART> attach vdisk

  100 percent completed

DiskPart successfully attached the virtual disk file.

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
———-  —  ———–  —–  ———-  ——-  ———  ——–
Volume 0     F                       CD-ROM          0 B  No Media
Volume 1     C                NTFS   Partition    465 GB  Healthy    System
Volume 2     D                NTFS   Partition    931 GB  Healthy
Volume 3     E                NTFS   Partition    931 GB  Healthy
Volume 4     G   System Rese  NTFS   Partition    100 MB  Healthy
Volume 5     V                NTFS   Partition    126 GB  Healthy

DISKPART> exit

Leaving DiskPart…

C:Userssuperman>dism /image:v: /get-Targeteditions

Deployment Image Servicing and Management tool
Version: 6.1.7600.16385

Image Version: 6.1.7600.16385

Editions that can be upgraded to:

Target Edition : ServerDataCenter
Target Edition : ServerEnterprise

The operation completed successfully.

C:Userssuperman>dism /image:v: /set-edition:ServerDataCenter

Deployment Image Servicing and Management tool
Version: 6.1.7600.16385

Image Version: 6.1.7600.16385

Starting to update components…
Removing package Microsoft-Windows-ServerEnterpriseEdition~31bf3856ad364e35~amd64~~6.1.7600.16385
[==========================100.0%==========================]
Finished updating components.

Starting to apply edition-specific settings…
Finished applying edition-specific settings.

The operation completed successfully.

C:Usersadministrator>diskpart

Microsoft DiskPart version 6.1.7600
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: HOME-HYPERV

DISKPART> select vdisk file=E:Hyper-Vlab-w2k8r2quicktestlab-w2k8r2quicktest.vhd

DiskPart successfully selected the virtual disk file.

DISKPART> detach vdisk

DiskPart successfully detached the virtual disk file.

DISKPART> exit

Leaving DiskPart…

C:Usersadministrator>

This VHD is actually from a Hyper-V server, and has been generalized before it was mounted on the host and upgraded.

Some more info about DIMS and image servicing: http://technet.microsoft.com/en-us/library/dd744543(WS.10).aspx

Leave a comment

Your email address will not be published. Required fields are marked *