Posts

Showing posts from February, 2014

Improvements on: Backup and restore Windows 7 activation status (Offline activation after reinstall)



This post is an elaboration of the necessary steps in order to backup Windows 7 activation status before doing a clean re-install and then restoring it back, with the command lines instructions to do the tricky parts. Note that a valid key is required; this does not support piracy, it just saves you from increasing the activation count on a valid key just because you are doing a clean install.
  1. Copy and save or backup the following activation-related files to external storage medium such as USB flash drive or portable hard disk drive: C:\Windows\ServiceProfiles\NetWorkService\
    AppData\Roaming\Microsoft\SoftwareProtectionPlatform\Tokens.dat
    and,C:\Windows\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms
    Note: For 64-bit (x64) OS, C:\Windows\SysWOW64\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms have to be backed up too.
  2. Retrieve and record the product key used to install and activate the current Windows 7 or Windows Server 2008 R2.
  3. Reinstall Windows 7 or Windows Server 2008 R2. When installation wizard prompts for a product key for activation, leave it blank (do not enter anything).
  4. In the newly installed Windows operating system, stop the Software Protection Service in Services.msc or with the following command (run in elevated command prompt): 
net stop sppsvc
  1. Navigate to the following folder:C:\Windows\System32\spp\tokens\pkeyconfig\
  2. Take ownership and give user full control permissions (alternatively add grant full control right click menu item) to pkeyconfig.xrm-ms file.
cd C:\Windows\System32\spp\tokens\pkeyconfig\
    takeown /f *
      cacls * /g users:f
        1. Delete the original default pkeyconfig.xrm-ms file, and replace with the backup copy.
        2. Note: In 64-bit (x64) operating system, also perform the above  actions in C:\Windows\SysWOW64\spp\tokens\pkeyconfig\ folder.
        cd C:\Windows\SysWOW64\spp\tokens\pkeyconfig\

        takeown /f *
          cacls * /g users:f
          1. Navigate to the following folder:C:\Windows\ServiceProfiles\NetWorkService\
            AppData\Roaming\Microsoft\SoftwareProtectionPlatform\ 
          2. Take ownership and give user full control permissions (alternatively add grant full control right click menu item) to tokens.dat file.
          cd C:\Windows\ServiceProfiles\NetWorkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\
          takeown /f *.dat
            cacls *.dat /g users:f
               

              1. Delete the original default tokens.dat file, and replace with the backup copy.
              2. Restart the Software Protection Service in Services.msc or with the following command (run in elevated command prompt):
               net start sppsvc
              1. Register the product key for Windows 7 or Windows Server 2008 R2 with the following command (run in elevated command prompt): slmgr.vbs -ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
                Replace xxxxx-xxxxx-xxxxx-xxxxx-xxxxx with the actual product key.
              2. Windows will activated instantly, off-line. To check activation status, uses of of the following commands: 
                • slmgr.vbs -dlv
                • slmgr.vbs -dli
                • slmgr.vbs -ato

              Install any version of Windows 7 from a single DVD

              *note* This idea should work, but it doesn't quite. Suggestions welcome!

              Any windows 7 x64 DVD has all x64 editions on it, and a single file which tells the disk which version to install. Remove that file and the installer will helpfully ask you which version you want! Note: the same is true of a x86 (32bit) disk, for all 32 bit editions of Win7.

              The file is ei.cfg and while there are tools to edit the ISO for you, wouldn't you rather know that nothing else has been done to the disk? A simple solution I tried, but which did not work is to edit the ISO with a hex editor that supports large (>2GB) files and Unicode (since filenames are stored as unicode). The hexeditor HxD works great for this. You can legally download the ISO direct from Microsoft's partner here (or see here for a list of versions).

              What does work is writing the ISO file to a USB flash drive using Rufus, and then deleting the EI.CFG file.

              For those curious on how to edit the ISO directly (which as I said, doesn't work), read on:

              In theory, all you need to do is change the file name on the disk. Search for ei.cfg (as a unicode string) and the first instance found is the file name (at offset 9D430). Change the 65 at that offset to a 64 and now it's di.cfg. Save and you are done! If you want to check, open the ISO file with a viewer (such as 7zip) and verify that the ei.cfg is now called di.cfg (it's in the \source directory). This clearly changes the name of the file. If you write the ISO to a USB flash drive, the result is as intended; the dialog box opens during install to ask what version you want. But if you burn it to DVD, the result is that halfway into the install Windows fails and claims it needs a driver to read the DVD. So somehow this hack corrupts the UDF image in a way that windows cannot recover from. I also tried searching for later references to ei.cfg, presuming these would be in the code that loads the file; there was only one additional reference in unicode, which I changed to di; the install disk now works ok, but does not load up the menu where you can change the edition. So there must be non-unicode instances of the file on the disk as well.



              Note that this has nothing to do with bypassing activation. This just allows you to use a single disk to install any version you want. You still need a valid product code for the version you installed. 


              Email me

              Name

              Email *

              Message *