Sysprep was not able to validate your Windows installation

On a machine running Windows 8, 8.1, 10 or even Windows Server 2012, 2012R2 or 2016 you can get a strange error when sysprepping the machine.

Sysprep was not able to validate your Windows installation.

(Error 0x8007139f)

Normally this is true because you can’t sysprep an upgraded machine. But I had this in a fresh install.

So the error is telling me to look in C:\Windows\System32\Sysprep\Panther and open the setupact.log file. So I did:

Error [0x0f0036] SYSPRP spopk.dll:: Sysprep will not run on an upgraded OS. You can only run Sysprep on a custom (clean) install version of Windows.

Error [0x0f0082] SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing ‘Sysprep_Clean_Validate_Opk’ from C:\Windows\System32\spopk.dll; dwRet = 0x139f

Error SYSPRP SysprepSession::Validate: Error in validating actions from C:\Windows\System32\Sysprep\ActionFiles\Cleanup.xml; dwRet = 0x139f

Error SYSPRP RunPlatformActions:Failed while validating SysprepSession actions; dwRet = 0x139f

Error [0x0f0070] SYSPRP RunExternalDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x139f

Error [0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep cleanup internal providers; hr = 0x8007139f

What we see here is that for some reason Windows thinks it has been upgraded.
Ok now we know that, what is the solution?

Actually pretty easy, in the registry!

In the HKEY_LOCAL_MACHINE\SYSTEM\Setup\ node you will
find a REG_DWORD ‘Upgrade‘ with a value of probably 0 (meaning not an upgrade…)

Just delete the ‘Upgrade’ key and you are good to go!

Not even a reboot is required.

Windows Installer Error Codes

When working with Windows msi installers you sometimes run into some kind of error or message.

Here is an overview of the most common errors or messages. They are most commonly found at the end of your installer log (always install with logging ;-)) usually prefaced by “MainEngineThread is returning”. This is the place where a zero is most preferred.

Enable logging on installation:

msiexec /I “yourInstaller.msi” /l*v “LOGlocation.log”

(There are versions where you have to use capital l (so L) instead of the lowercase l)

Value Description Error Code
0 Action completed successfully. ERROR_SUCCESS
13 The data is invalid. ERROR_INVALID_DATA
87 One of the parameters was invalid. ERROR_INVALID_PARAMETER
120 This function is not available for this platform. It is only available on Windows 2000 and Windows XP with Window Installer version 2.0. ERROR_CALL_NOT_IMPLEMENTED
1259 This error code only occurs when using Windows Installer version 2.0 and Windows XP or later. If Windows Installer determines a product may be incompatible with the current operating system, it displays a dialog informing the user and asking whether to try to install anyway. This error code is returned if the user chooses not to try the installation. ERROR_APPHELP_BLOCK
1601 The Windows Installer service could not be accessed. Contact your support personnel to verify that the Windows Installer service is properly registered. ERROR_INSTALL_SERVICE_FAILURE
1602 User cancel installation. ERROR_INSTALL_USEREXIT
1603 Fatal error during installation. ERROR_INSTALL_FAILURE
1604 Installation suspended, incomplete. ERROR_INSTALL_SUSPEND
1605 This action is only valid for products that are currently installed. ERROR_UNKNOWN_PRODUCT
1606 Feature ID not registered. ERROR_UNKNOWN_FEATURE
1607 Component ID not registered. ERROR_UNKNOWN_COMPONENT
1608 Unknown property. ERROR_UNKNOWN_PROPERTY
1609 Handle is in an invalid state. ERROR_INVALID_HANDLE_STATE
1610 The configuration data for this product is corrupt. Contact your support personnel. ERROR_BAD_CONFIGURATION
1611 Component qualifier not present. ERROR_INDEX_ABSENT
1612 The installation source for this product is not available. Verify that the source exists and that you can access it. ERROR_INSTALL_SOURCE_ABSENT
1613 This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service. ERROR_INSTALL_PACKAGE_VERSION
1614 Product is uninstalled. ERROR_PRODUCT_UNINSTALLED
1615 SQL query syntax invalid or unsupported. ERROR_BAD_QUERY_SYNTAX
1616 Record field does not exist. ERROR_INVALID_FIELD
1618 Another installation is already in progress. Complete that installation before proceeding with this install. ERROR_INSTALL_ALREADY_RUNNING
1619 This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package. ERROR_INSTALL_PACKAGE_OPEN_FAILED
1620 This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package. ERROR_INSTALL_PACKAGE_INVALID
1621 There was an error starting the Windows Installer service user interface. Contact your support personnel. ERROR_INSTALL_UI_FAILURE
1622 Error opening installation log file. Verify that the specified log file location exists and is writable. ERROR_INSTALL_LOG_FAILURE
1623 This language of this installation package is not supported by your system. ERROR_INSTALL_LANGUAGE_UNSUPPORTED
1624 Error applying transforms. Verify that the specified transform paths are valid. ERROR_INSTALL_TRANSFORM_FAILURE
1625 This installation is forbidden by system policy. Contact your system administrator. ERROR_INSTALL_PACKAGE_REJECTED
1626 Function could not be executed. ERROR_FUNCTION_NOT_CALLED
1627 Function failed during execution. ERROR_FUNCTION_FAILED
1628 Invalid or unknown table specified. ERROR_INVALID_TABLE
1629 Data supplied is of wrong type. ERROR_DATATYPE_MISMATCH
1630 Data of this type is not supported. ERROR_UNSUPPORTED_TYPE
1631 The Windows Installer service failed to start. Contact your support personnel. ERROR_CREATE_FAILED
1632 The temp folder is either full or inaccessible. Verify that the temp folder exists and that you can write to it. ERROR_INSTALL_TEMP_UNWRITABLE
1633 This installation package is not supported on this platform. Contact your application vendor. ERROR_INSTALL_PLATFORM_UNSUPPORTED
1634 Component not used on this machine ERROR_INSTALL_NOTUSED
1635 This patch package could not be opened. Verify that the patch package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer patch package. ERROR_PATCH_PACKAGE_OPEN_FAILED
1636 This patch package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer patch package. ERROR_PATCH_PACKAGE_INVALID
1637 This patch package cannot be processed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service. ERROR_PATCH_PACKAGE_UNSUPPORTED
1638 Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel. ERROR_PRODUCT_VERSION
1639 Invalid command line argument. Consult the Windows Installer SDK for detailed command line help. ERROR_INVALID_COMMAND_LINE
1640 Installation from a Terminal Server client session not permitted for current user. ERROR_INSTALL_REMOTE_DISALLOWED
1641 The installer has started a reboot. This error code not available on Windows Installer version 1.0. ERROR_SUCCESS_REBOOT_INITIATED
1642 The installer cannot install the upgrade patch because the program being upgraded may be missing or the upgrade patch updates a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch.
This error code is not available on Windows Installer version 1.0.
ERROR_PATCH_TARGET_NOT_FOUND
1643 The patch package is not permitted by system policy. This error code is available with Windows Installer versions 2.0 or later. ERROR_PATCH_PACKAGE_REJECTED
1644 One or more customizations are not permitted by system policy. This error code is available with Windows Installer versions 2.0 or later. ERROR_INSTALL_TRANSFORM_REJECTED
3010 A reboot is required to complete the install. This does not include installs where the ForceReboot action is run. This error code not available on Windows Installer version 1.0. ERROR_SUCCESS_REBOOT_REQUIRED

Windows Server 2012 KMS Service Activation

So we have Windows Server 2012 and Windows 8 RTM and want to activate them with our KMS server. For this to be successful we need to update our KMS Service, with is currently servicing out Windows Server 2008 R2 servers and Windows 7 clients.

When we try to activate a Server 2012 server the following error will occur:

To resolve this issue:

Download and install the following update: KB2757817 (Update adds support for Windows 8 and Windows Server 2012 to Windows Server 2008, Windows 7, and Windows Server 2008 R2 KMS hosts).

How to obtain this update

The following files are available for download from the Microsoft Download Center:Collapse this tableExpand this table

Operating system Update
All supported x86-based versions of Windows Vista and of Windows Server 2008 Collapse this imageExpand this image

Download the update package now.

(http://www.microsoft.com/downloads/details.aspx?FamilyId=cca1a7a5-10f5-4aea-b0c5-999f2dc9f07f)

All supported x64-based versions of Windows Vista and of Windows Server 2008 Collapse this imageExpand this image

Download the update package now.

(http://www.microsoft.com/downloads/details.aspx?FamilyId=85cdb6a5-9658-47b3-b344-0284954a7379)

All supported IA-64-based versions of Windows Vista and of Windows Server 2008 Collapse this imageExpand this image

Download the update package now.

(http://www.microsoft.com/downloads/details.aspx?FamilyId=799f0f06-cbca-483c-8130-9bb99d8dc87e)

All supported x86-based versions of Windows 7 Collapse this imageExpand this image

Download the update package now.

(http://www.microsoft.com/downloads/details.aspx?FamilyId=a1829040-975f-43ab-877d-5cf4a5382987)

All supported x64-based versions of Windows 7 Collapse this imageExpand this image

Download the update package now.

(http://www.microsoft.com/downloads/details.aspx?FamilyId=23fd50b9-baa5-466f-9dff-af06729f23a9)

All supported x64-based versions of Windows Server 2008 R2 Collapse this imageExpand this image

Download the update package now.

(http://www.microsoft.com/downloads/details.aspx?FamilyId=bd2cda64-6319-4beb-91e3-9439048bf19d)

All supported IA-64-based versions of Windows Server 2008 R2 Collapse this imageExpand this image

Download the update package now.

 

If you don’t install this Update then registering a Windows Server 2012 KMS will throw an Error: 0xC004F050 The Software Licensing Service reported that the product key is invalid.

So install the update (Windows6.1-KB2757817-x64.msu) and restart the server!
Just restarting the KMS service (“net stop sppsvc” and “net start sppsvc“) is NOT enough.

Let’s see what is already running:

slmgr.vbs /dlv => The Windows 2008 R2 KMS key.

Uninstall the current KMS key using slmgr.vbs /upk
(We all know this has to be done from an elevated command prompt..)

Now it is time to install the new KMS key.

slmgr.vbs /ipk {YOUR_SERVER_2012_KMS_KEY}

slmgr.vbs /ato to activate the KMS Service

And now we can check our environment to see what we can activate:

slmgr.vbs /dlv => the Windows Server 2012 KMS key.

 

RoboCopy switches

So I was busy with the most fabulous copy tool ever – RoboCopy.
I always forget the exact switches, so for reference use here they are:

/S Copies subdirectories (excluding empty ones).
/E Copies all subdirectories (including empty ones).
/LEV:n Copies only the top n levels of the source directory tree.
/Z Copies files in restartable mode (that is, restarts the copy process from the point of failure).
/B Copies files in Backup mode (Backup copies are not restartable, but can copy some files that restartable mode cannot).
/ZB Tries to copy files in restartable mode, but if that fails with an “Access Denied” error, switches automatically to Backup mode.
/COPY:copyflags Copies the file information specified by copyflags, which can be any combination of the following :
D – file Data. S – file Security (NTFS ACLs).
A – file Attributes. O – file Ownership information.
T – file Timestamps. U – file aUditing infomation.
Source and destination volumes must both be NTFS to copy Security, Ownership or Auditing information.
/COPYALL Copies Everything. Equivalent to /COPY:DATSOU.
/NOCOPY Copies Nothing. Can be useful with /PURGE.
/SEC Copies NTFS security information. (Source and destination volumes must both be NTFS). Equivalent to /COPY:DATS.
/MOV Moves files (that is, deletes source files after copying).
/MOVE Moves files and directories (that is, deletes source files and directories after copying).
/PURGE Deletes destination files and directories that no longer exist in the source.
/MIR Mirrors a directory tree (equivalent to running both /E and /PURGE).
/A+:{RASHNT} Sets the specified attributes in copied files.
The following attributes can be set:
R – Read only S – System N – Not content indexed
A – Archive H – Hidden T – Temporary
/A-:{RASHNT} Turns off the specified attributes in copied files.
The following attributes can be turned off:
R – Read only S – System N – Not content indexed
A – Archive H – Hidden T – Temporary
/CREATE Creates a directory tree structure containing zero-length files only (that is, no file data is copied).
/FAT Creates destination files using only 8.3 FAT file names.
/FFT Assume FAT File Times (2-second granularity). Useful for copying to third-party systems that declare a volume to be NTFS but only implement file times with a 2-second granularity.
/MON:n Monitors the source directory for changes, and runs again when n changes have been detected, and the minimum time interval specified by /MOT has elapsed.
/MOT:n Monitors the source directory for changes, and runs again when a further n minutes have elapsed, and the minimum number of changes specified by /MON have been detected.
/RH:hhmm-hhmm Defines the time slot during which starting new copies is allowed. Useful for restricting copies to certain times of the day. Both values must be 24-hour times in the range 0000 to 2359.
/PF Makes more frequent checks to see if starting new copies is allowed (per file rather than per pass). Useful in stopping copy activity more promptly at the end of the run hours time slot.
/IPG:n Inserts a delay of n milliseconds after each 64k chunk of file data is copied. Useful for freeing up bandwidth on slow lines.
/IA:{RASHCNETO} Includes files with the specified attributes.
The following file attributes can be acted upon:
R – Read only A – Archive S – System
H – Hidden C – Compressed N – Not content indexed
E – Encrypted T – Temporary O – Offline
/XA:{RASHCNETO} Excludes files with the specified attributes.
The following file attributes can be acted upon:
R – Read only A – Archive S – System
H – Hidden C – Compressed N – Not content indexed
E – Encrypted T – Temporary O – Offline
/A Copies only files with the archive attribute set.
/M Copies only files with the archive attribute set and then resets (turns off) the archive attribute in the source files.
/XJ Excludes Junction points.
/XF file [file] Excludes files with the specified names, paths, or wildcard characters.
/XD dir [dir] Excludes directories with the specified names, paths, or wildcard characters.
/XC Excludes files tagged as “Changed”.
/XN Excludes files tagged as “Newer”.
/XO Excludes files tagged as “Older”..
/XX Excludes files and directories tagged as “Extra”.
/XL Excludes files and directories tagged as “Lonely”.
/IS Includes files tagged as “Same”.
/IT Includes files tagged as “Tweaked”.
/MAX:n Excludes files larger than n bytes.
/MIN:n Excludes files smaller than n bytes.
/MAXAGE:n Excludes files with a Last Modified Date older than n days or specified date. If n is less than 1900, then n is expressed in days. Otherwise, n is a date expressed as YYYYMMDD.
/MINAGE:n Excludes files with a Last Modified Date newer than n days or specified date. If n is less than 1900, then n is expressed in days. Otherwise, n is a date expressed as YYYYMMDD.
/MAXLAD:n Excludes files with a Last Access Date older than n days or specified date. If n is less than 1900, then n is expressed in days. Otherwise, n is a date expressed as YYYYMMDD.
/MINLAD:n Excludes files with a Last Access Date newer than n days or specified date. If n is less than 1900, then n is expressed in days. Otherwise, n is a date expressed as YYYYMMDD.
/R:n Specifies the number of retries on failed copies. (The default is 1 million.)
/W:n Specifies the wait time between retries. (The default is 30 seconds.)
/REG Saves /R:n and /W:n in the registry as default settings.
/TBD Waits for share names to be defined on a “Network Name Not Found” error.
/L Lists files without copying, deleting, or applying a time stamp to any files.
/X Reports all files tagged as “Extra”(including files not selected).
/V Produces verbose output (including skipped files).
/TS Displays source file timestamps in the output log.
/FP Displays full pathnames of files in the output log.
/NC Suppresses output of Robocopy file classes.
/NS Suppresses output of file and directory sizes.
/NDL Turns off logging of directory names. Full file pathnames (as opposed to simple file names) will be shown if /NDL is used.
/NFL Turns off logging of file names. File names are still shown, however, if file copy errors occur.
/NJH Turns of logging of the job header.
/NJS Turns off logging of the job summary.
/NP Turns off copy progress indicator (% copied).
/ETA Shows estimated time of completion for copied files.
/LOG:file Redirects output to the specified file, overwriting the file if it already exists.
/LOG+:file Redirects output to the specified file, appending it to the file if it already exists.
/TEE Displays output in the console window, in addition to directing it to the log file specified by /LOG or /LOG+.
/JOB:job Reads parameters from the named Job file.
/SAVE:job Writes the current parameter settings to the named Job file.
/QUIT Quits after processing the command line. No files will be copied. Use /QUIT with /JOB to view job file contents.
/NOSD Declares that no source directory is specified. Useful in template Jobs for which the source is provided at run time.
/NODD Declares that no destination directory is specified. Useful in template Jobs for which the destination is provided at run time.
/IF Includes files with the specified names, paths, or wildcard characters. Intended for use in Job files only.
/SD:path Explicity specifies the source directory for the copy. Intended for use in Job files only.
/DD:path Explicitly specifies the destination directory for the copy. Intended for use in Job files only.