dimanche 12 avril 2015

Activating Windows 8.1 with BIOS product key with batch command

I need to deploy windows images to several computers that came with Windows 8.1. I did manage to inject drivers and updates and some necessary softwares, but somehow it seems that just installing Windows won't activate the operating system, and I have to find the license keys embedded in the BIOS and activate the manually.


I found out that wmic path softwarelicenseingservice get oa3xoriginalproductkey could be used to extract the product key from the bios, and I am thinking about composing a batch file that uses this command in joint with slmgr -ipk and slmgr -ato, and then make it run as the firstlogon command.


The trouble is that I don't know a lot about batch syntax, and I am having a hard time assigning the product key as a variable and passing it over to slmgr commands.


It seems that the wmic command returns the result as:



OA3xOriginalProductKey
XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
<blank line>


So there it returns the product key in a three line text, with the actual useful information sandwiched between other strings. How can I just get the middle(or second) line from this text?


Aucun commentaire:

Enregistrer un commentaire