New
#11
here's an example, not of the whose scenario, but this shows you how to read your own Product Key:
Script:
# ************************************************************
# Get Product License Key
# Source is PowerShell.com > PowerTips > Getttin Windows Product Key
# For those interested in learning PowerShell this is an excellent site.
# See their 'Mastering PowerShell' for a thorough presentation of xx chapters
# ************************************************************
# ************************************************************
# Start copying with next uncommented line (no # in first character;
# Copy thru 2nd EXIT;
# Paste into PowerShell using right-click
# ************************************************************
function Get-ProductKey {
$map="BCDFGHJKMPQRTVWXY2346789"
$value = (get-itemproperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").digitalproductid[0x34..0x42]
$ProductKey = ""
for ($i = 24; $i -ge 0; $i--) {
$r = 0
for ($j = 14; $j -ge 0; $j--) {
$r = ($r * 256) -bxor $value[$j]
$value[$j] = [math]::Floor([double]($r/24))
$r = $r % 24
}
$ProductKey = $map[$r] + $ProductKey
if (($i % 5) -eq 0 -and $i -ne 0) {
$ProductKey = "-" + $ProductKey
}
}
$ProductKey
}
Get-ProductKey > $env:userprofile\Desktop\ProductKey.TXT
EXIT
EXIT
# ************************************************************
# Places ProductKey.TXT on your DESKTOP
#
# **********************INSTRUCTIONS**************************
# STEP 1 *****************************************************
# RUN PowerShell as administrator
# START ORB | type POWERSHELL | CTRL+SHIFT+ENTER key combo | ALT+Y keycombo
# ************************************************************
# STEP 2 *****************************************************
# COPY, using CTRL+C, every line down thru both EXIT statements
# PASTE into Powershell == Right-Click at the PowerShell Prompt
# (Ctrl+V does not work)
# ************************************************************
# ***************** NOTE - POWERSHELL VERSION*****************
# if you receive this error msg:
# Get-WinEvent: The system can not find the path specified
# you need to update your PowerShell
# you must be using Powershell 2.0 or later.
#
# To determine your Powershell version:
# Run PowerShell
# enter $host.version
# you should see at least:
# Major Minor Build Revision
# ----- ----- ----- --------
# 2 0 -1 -1
#
# If you do not see the above, update your Vista/Win 7.
# ************************************************************
# *************** NOTE - EXECUTION POLICY*********************
# If you haven't set the execution policy, you may need to:
# Run PowerShell
# enter Set-ExecutionPolicy -executionpolicy remotesigned
#
# ************************************************************