[Batch] Help with Reading OEM-DM Key & PID Info from WinPE.

Discussion in 'Scripting' started by Flipp3r, Jul 27, 2014.

  1. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,962
    904
    60
    Hi,

    I'm trying to read the ProductKey from the MSDM Table & work out what edition it is from WinPE (64bit).
    I've been unable to find any way to do this.
    Within Windows there are tools:
    - RW-Everything can view the MSDM table. You can script it to dump the Table from a batch file. Can't get it to run in WinPE.
    - OEM-DM can display the key.
    - The Ulitmate PID Checker can give me the info I need. Doesn't have command line options though.

    Not all notebooks/PC's have a Win8/Win8Pro sticker on them so it would be handy to just boot up my WinPE & get a dump/info if a MSDM table exists.
    Or would I have to go with WinSE for this???
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,104
    24,378
    340
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,962
    904
    60
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,962
    904
    60
    Ok, using Win8.1SE & woot332's Windows-9-Product-Key-Viewer I'm now able to retrieve the OEM-DM Key. :clap:

    Using the following from a command prompt worked as well:
    Code:
    powershell "(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey"
    *Update*

    Sorry, the above powershell command does NOT work in the WinPE environment...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. user_hidden

    user_hidden MDL Expert

    Dec 18, 2007
    1,034
    1,061
    60
    #5 user_hidden, Sep 23, 2014
    Last edited by a moderator: Apr 20, 2017
    VBScript

    Code:
    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

    DOS Cmdline
    Code:
    @echo off
    WMIC Path SoftwareLicensingService Get OA3xOriginalProductKey
    pause>null
     
  6. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,962
    904
    60
    #6 Flipp3r, Sep 24, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    These are useful but alas don't work in a WinPE environment...
    Well, I should say DEFAULT WinPE Environment.

    I'll have to try adding WinPE-WMI.cab & WinPE-PowerShell.cab to see if it helps...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Horwatt

    Horwatt MDL Junior Member

    Oct 16, 2009
    56
    129
    0
    #7 Horwatt, Nov 17, 2014
    Last edited by a moderator: Apr 20, 2017
    It would be nice to add the command key input.
     
  8. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,962
    904
    60
    #8 Flipp3r, Jan 31, 2015
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Just to let you know the latest version of RW-Everything (1.6.7) now works in WinPE.

    You can use command line options with rw protable. ie:
    Code:
    rw.exe /command=msdm.rw /logfile=MSDM.txt
    where msdm.rw contains:
    Code:
    >ACPI Dump MSDM
    >RwExit
    All my tools in WinPE are in the X:\Tools folder. So just to display the key, you could have the following in a batch file:
    Code:
    @echo off
    cd X:\Tools\RWPortable%PROCESSOR_ARCHITECTURE%
    rw.exe /command=msdm.rw /logfile=X:\Tools\MSDM.txt
    for /f "skip=24 tokens=1-2" %%a in (X:\Tools\MSDM.txt) do (
         echo OEM-DM Key^: %%b
       )
    cd X:\Tools
    If there is no MSDM table then OEM-DM Key is blank.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...