Batch file to lookup windows 8.1 key from bios and insert it into windows and activat

Discussion in 'Windows 8' started by tubbylad, Apr 10, 2015.

  1. tubbylad

    tubbylad MDL Novice

    Oct 2, 2011
    3
    0
    0
    Hi

    I have some windows 8.1 machines to reinstall. After installing windows I am looking for a quick and convenient way to activate them with the BIOS embedded product key. I have found sometimes rw everything doesn't always work, it locks up or comes up with a memory error.

    I seen this command powershell "(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey"

    I tried it on a machine and it did bring up the product key. I then typed slui 3 and then typed the serial into the window and activated it.

    I wondered if anyone had or used a batch file to do this? Ideally I would like the batch file to read the key and insert it into the windows edition, but even if I was able to display the key in a command prompt and bring up the activation window so I could type it myself.

    Lastly does the powershell command above work on any widnows 8 machine, or has anyone come across branded machines where it doesn't display the key?
     
  2. genet

    genet MDL Novice

    Mar 10, 2013
    36
    23
    0
  3. tubbylad

    tubbylad MDL Novice

    Oct 2, 2011
    3
    0
    0
    Hi

    Thanks for your reply.

    I've found from experience it very rarely activates by itself. In most cases I've reinstalled windows and it has not read the key from the bios. I am not using a usb or dvd drive installer. I created a reference install, then run sysprep to create a general image. I can then clone this to any machine. It doesn't pick up the product key from the bios, but uses the KMS key I used to complete the original install. I need to run rw everything to get the key from the bios, then load up the activation wizard and activate it. This is fine, but rw everything doesn't work on every machine. Some machines it locks up, or comes up out of memory error.

    I was hoping I could do this with a batch file because I've found the powershell command above to bring up the key.

    thanks
     
  4. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. roevmannen

    roevmannen MDL Novice

    Jun 2, 2012
    10
    3
    0
    #5 roevmannen, Apr 11, 2015
    Last edited by a moderator: Apr 20, 2017
    I've put together a PowerShell script that does it all.

    Code:
    $key = (Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey
    $service = get-wmiObject -query "select * from SoftwareLicensingService"
    $service.InstallProductKey($key)
    $service.RefreshLicenseStatus()
     
  6. tubbylad

    tubbylad MDL Novice

    Oct 2, 2011
    3
    0
    0
    #6 tubbylad, Apr 11, 2015
    Last edited by a moderator: Apr 20, 2017
    (OP)
    that's what I'm looking for, thanks I'll try this out.
     
  7. roevmannen

    roevmannen MDL Novice

    Jun 2, 2012
    10
    3
    0
    #7 roevmannen, Apr 12, 2015
    Last edited by a moderator: Apr 20, 2017
    You may need to disable UAE to make it run.
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
    "PromptOnSecureDesktop"=dword:00000001
    "EnableLUA"=dword:00000000
    "ConsentPromptBehaviorAdmin"=dword:00000005