[No Need] Convert .ps1 to .cmd

Discussion in 'Scripting' started by xinso, Oct 12, 2014.

  1. xinso

    xinso MDL Guru

    Mar 5, 2009
    12,531
    13,522
    340
    #1 xinso, Oct 12, 2014
    Last edited by a moderator: Apr 20, 2017
    Could you please?

    Read Key from MSDM Table
    Code:
    $currentpath = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
    $key = .\GetWin8Key.exe 
    slmgr.vbs -ipk $key
    slmgr.vbs -ato
    Start-Sleep -Seconds 10
    kill -Name wscript* -Force
    Thanks

    Edit: There's no need any more, 'cause it won't work under WinPE.
     
  2. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,104
    24,378
    340
    #2 s1ave77, Oct 12, 2014
    Last edited by a moderator: Apr 20, 2017
    How about using this to gather the key :g::
    Code:
    powershell "(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey"

    BTW: FaiKee posted this some time ago :good3:.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. xinso

    xinso MDL Guru

    Mar 5, 2009
    12,531
    13,522
    340
    #3 xinso, Oct 12, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Thank Slave77,

    I've tried OEM-DM.exe using WMIC and Powershell ways (I have no idea about VB) under WinPE 5.1 but to no avail.

    Code:
    WMIC:
    WMIC Path SoftwareLicensingService Get OA3xOriginalProductKey /format:list
    
    PowerShell:
    powershell (Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA2xBiosMarkerStatus
    
    VB:
    strComputer = "." 
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
    Set colItems = objWMIService.ExecQuery( _
        "SELECT * FROM SoftwareLicensingService",,48) 
    For Each objItem in colItems 
         Wscript.Echo "OEM_DM Bios Key: " & objItem.OA3xOriginalProductKey
    Next
    PS. Powershell relevant components been added.
     
  4. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,770
    1,101
    60
    #4 Mr Jinje, Oct 12, 2014
    Last edited by a moderator: Apr 20, 2017
    Here are some slightly off-topic source codes, shows exactly where the data resides in the MSDM table ( byte 56 ) in python.

    https://github.com/christian-korneck/get_win8key

     
  5. xinso

    xinso MDL Guru

    Mar 5, 2009
    12,531
    13,522
    340
    #5 xinso, Oct 12, 2014
    Last edited: Oct 13, 2014
    (OP)
    Thank you, but I can use simple DOS script only.