Currently I am creating a Windows PE image in order to perform some common tasks outside of the actual operating system (as a recovery disk). A few of the tasks that this image will be able to perform will include a registry recovery (from an initial backup) and multiple check disk functions. During the registry recovery from backup, the Windows 7 product key association in the registry is either invalidated or deleted, and when the computer is booted to the actual OS, Windows asks for the product key to activate itself.

This happens about 90% of the time that I'm recovering the registry, and it isn't a problem to insert the product key after boot, however, it is quite tedious. In order to remedy this, I've been attempting to figure out a way to insert the product key with some command line functions from my WinPE image, utilizing slmgr /ipk ##-## and slmgr /ato after Windows 7 starts.

I've been able to write a batch script to (attempt to) import the key and add slmgr /ato to the registry to run at startup, but I've been unsuccessful in getting slmgr /ipk ##-## to run in the Windows PE environment. The problem that I'm having is along the lines of this:

Can't find script engine "VBScript" for script "C:\Windows\System32\slmgr.vbs"

I've tried registering the .dlls associated with .vbs files (vbscript and jscript to my knowledge) in the System32 and SysWOW64 folders. I've tried importing one of the various Windows Vista/7 registry files found around the web that restore the functionality of .vbs files. I've also tried cscript and wscript, both of which tell me the same error about lacking a scripting engine.

My question is, is there any way to push an activation key onto a Windows 7 drive through a WinPE recovery environment? Is there some additional package that I should be adding to my .wim to achieve the ability to use .vbs files, or is there a better way to activate Windows from inside WinPE than using slmgr.vbs?

Thank you for any assistance.

  • Have you verified that WinPE even has the ability to run VBScript because the error indicates it does not ( at least not in your image ). discussion 1 You need to basically add the package that handles VBScript before your plan will work. more information additionally I would just convert the vbscript in question to powershell and be done with it. – Ramhound Aug 1 '14 at 12:07
  • I believe it has the ability to run VBScript in WinPE 5 (8.1)+, but that also has PowerShell, and I think there's a way to do what I want to do solely with PowerShell. Thank you regardless though! – John Aug 10 '14 at 4:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.