Read Windows Keys from Registry and BIOS (OEM Key) (FOG Client)



  • Hi,

    there are popular tools out there, PDQ Inventory or Spiceworks that can extract the Windows Keys from the Registry.
    Is there a way to extend the FOG Client to read the Keys and Report it back to FOG so it can add it automatically to the host?

    Maybe the popular tool Produkey from Nirsoft can be used for this: http://www.nirsoft.net/utils/product_cd_key_viewer.html

    ProduKey.exe /WindowsKeys 1 /OfficeKeys 0 /IEKeys 0 /SQLKeys 0 /ExchangeKeys 0 /ExtracEdition 0 /sjson key.json
    
    [
    
    {
    "Product Name":"Windows 10 Pro",
    "Product ID":"00330-80000-00000-AA447",
    "Product Key":"XXXXX-XXXXX-XXXXX-XXXXX-XXXXX",
    "Installation Folder ":"C:\\Windows",
    "Service Pack":"",
    "Computer Name":"XXX",
    "Modified Time":"10.03.2017 17:05:21"
    }
    
    ]
    

    FOG Client, could check this once a day and report the product key back to the fog db.

    Could be really useful when updating older Windows 7 Clients to Windows 10, i could rollout the FOG Client to that machines for example with PDQ Deploy, then i will recieve current Windows 7 Key and can Deploy Windows 10 :)

    I have also a binary to read out the Windows 8/8.1/10 key from bios: http://xup.in/dl,10366557

    I am using it with the following script to deploy it as snapin, that way all bios embedded keys will be activated after deployment

    @echo off
    for /f "tokens=*" %%i in ('%cd%\oemkey') do set oemkey=%%i
    cscript %systemroot%\system32\slmgr.vbs /ipk %oemkey% >nul
    cscript %systemroot%\system32\slmgr.vbs /ato >nul
    exit
    

    Alternative with Administrative Powershell (only BIOS Keys):

    (Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey
    

    Regards X23



  • @goempie said in Read Windows Keys from Registry and BIOS (OEM Key) (FOG Client):

    Hello
    I’m trying to get your script working, but can’t get it to work.

    Does the bat to exe converter also pack in the oemkey.exe or do i have to copy the oemkey.exe to a directory in my image?

    Thanks

    setkey.exe in the bin directory is the finished product. oemkey.exe is packed into setkey.exe while the script itself is also in oemkey.exe but executed from setkey.exe itself.

    All you need is setkey.exe to be executed as admin (snapin) nothing i just uploaded everything together because people may leery when can’t see the source of it.

    Regards X23



  • Hello
    I’m trying to get your script working, but can’t get it to work.

    Does the bat to exe converter also pack in the oemkey.exe or do i have to copy the oemkey.exe to a directory in my image?

    Thanks



  • Hi,

    today i was asked the following by a user in the chat.
    I just paste it here because it could be useful for others:

    @SnufflePumpkin

    Hi there. Saw your post about deploying a Windows 10 image. I am attempting to do the same and was wondering how you run the script for the oemkey part. I have an image already finished and attempted to deploy it today, but noticed that Windows would not activate as it was trying to use (I assume) the key from the computer I created the image on. I can find and enter the OEM product key manually, but I’d prefer it to take care of this during the sysprep generalize step if possible. How can I use your oemkey script in my image to help take care of this problem?

    x23piracy
    Hi, i have a binary that i trigger with setupcomplete that will read out the bios key and activate windows with the first logon (unattend.xml)
    i described that in forums let me have a look if i will find it
    look at this: https://forums.fogproject.org/topic/9694/read-windows-keys-from-registry-fog-client
    I am using it with the following script to deploy it as snapin, that way all bios embedded keys will be activated after deployment

    @echo off
    for /f “tokens=*” %%i in (’%cd%\oemkey’) do set oemkey=%%i
    cscript %systemroot%\system32\slmgr.vbs /ipk %oemkey% >nul
    cscript %systemroot%\system32\slmgr.vbs /ato >nul
    exit
    

    i can give you the binary i found it somewhere on the net
    Here is the binary: http://www.xup.in/dl,10419245/oemkey.zip/

    i show you a screener of what it does
    alt text

    i simply use the returning key to activate windows ;)
    i packed the binary and the script that is doing the action into an exe file that will be used as snapin with fog
    if you like i can give you my finished package two, all you need to do is to add it as snapin and enable it for a client when you deploy.

    Attention: I used a bat to exe converter, you need to adjust the path’s in its config so it can find the files in your system ;)

    Here is the complete package: http://www.xup.in/dl,10862536/OEMKey.zip/
    under install setkey.exe is the snapin

    Regards X23


  • Senior Developer

    @x23piracy the client certainly has the capability to do what you’re asking, infact it already has the internal API built to manage the Window’s registry. However, this is definitely beyond the scope of what we’re will to add to 1.X due to the needed server changes. With that said, this would be a fairly straight forward FOG 2.0 plugin, when its ready.

    In the mean time, like you already said, snapins are your best bet.


Log in to reply
 

463
Online

39209
Users

10856
Topics

103336
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.