Retrieve several info from your computer
function get-windowsproductkey([string]$computer)
{
$Reg = [WMIClass] ("\\" + $computer + "\root\default:StdRegProv")
$values = [byte[]]($reg.getbinaryvalue(2147483650,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","DigitalProductId").uvalue)
$lookup = [char[]]("B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9")
$keyStartIndex = [int]52;
$keyEndIndex = [int]($keyStartIndex + 15);
$decodeLength = [int]29
$decodeStringLength = [int]15
$decodedChars = new-object char[] $decodeLength
$hexPid = new-object System.Collections.ArrayList
for ($i = $keyStartIndex; $i -le $keyEndIndex; $i++){ [void]$hexPid.Add($values[$i]) }
for ( $i = $decodeLength - 1; $i -ge 0; $i--)
{
if (($i + 1) % 6 -eq 0){$decodedChars[$i] = '-'}
else
{
$digitMapIndex = [int]0
for ($j = $decodeStringLength - 1; $j -ge 0; $j--)
{
$byteValue = [int](($digitMapIndex * [int]256) -bor [byte]$hexPid[$j]);
$hexPid[$j] = [byte] ([math]::Floor($byteValue / 24));
$digitMapIndex = $byteValue % 24;
$decodedChars[$i] = $lookup[$digitMapIndex];
}
}
}
$STR = ''
$decodedChars | % { $str+=$_}
$STR
}
cls
Write-Host "`n"
Write-Host "*************************"
Write-Host "A window of your computer"
Write-Host "*************************"
Write-Host "`n"
while ($true)
{
Write-Host "`n"
Write-Host " e) Exit 18) Win Event Log"
Write-Host " 1) BIOS 19) Event Log"
Write-Host " 2) Computer System 20) Date"
Write-Host " 3) Product 21) Windows Product Key"
Write-Host " 4) Operating System"
Write-Host " 5) Logical Disk"
Write-Host " 6) Culture"
Write-Host " 7) Quick Fix Engineering"
Write-Host " 8) Logon Session"
Write-Host " 9) Process"
Write-Host "9d) Process Details"
Write-Host "10) Services"
Write-Host "11) Printer"
Write-Host "12) Ps drive"
Write-Host "13) Network Connection"
Write-Host "14) Jobs"
Write-Host "15) Ps session"
Write-Host "16) Execution policy"
Write-Host "17) Computer Store Point"
Write-Host "`n"
$choice = Read-Host -Prompt 'Choice?'
Write-Host "`n"
if ($choice -eq "e")
{
break
}
if ($choice -eq "1") #BIOS
{
Get-WmiObject -Class Win32_BIOS
}
if ($choice -eq "2") #Computer System
{
Get-WmiObject -Class Win32_ComputerSystem
Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property SystemType
Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property UserName
}
if ($choice -eq "3") #Product
{
Get-WmiObject -Class Win32_Product
}
if ($choice -eq "4") #Operating System
{
Get-WmiObject -Class Win32_OperatingSystem
Get-WmiObject -Class Win32_OperatingSystem | Select-Object -Property Build*,OSType,ServicePack*
Get-WmiObject -Class Win32_OperatingSystem | Select-Object -Property *user*
}
if ($choice -eq "5") #Logical Disk
{
Get-WmiObject -Class Win32_LogicalDisk
}
if ($choice -eq "6") #Culture
{
get-culture
}
if ($choice -eq "7") #Quick Fix Engineering
{
Get-WmiObject -Class Win32_QuickFixEngineering
}
if ($choice -eq "8") #Logon Session
{
Get-WmiObject -Class Win32_LogonSession
}
if ($choice -eq "9") #Process
{
Get-Process
}
if ($choice -eq "9d") #Process Details
{
get-wmiobject win32_process
}
if ($choice -eq "10") #Service
{
get-service
}
if ($choice -eq "11") #Printer
{
Get-WmiObject -Class Win32_Printer
}
if ($choice -eq "12") #Ps drive
{
get-psdrive
}
if ($choice -eq "13") #Network Connection
{
get-wmiobject win32_networkconnection
}
if ($choice -eq "14") #Jobs
{
get-job
}
if ($choice -eq "15") #Ps session
{
get-pssession
}
if ($choice -eq "16") #Execution policy
{
get-executionpolicy
}
if ($choice -eq "17") #Computer Store Point
{
get-computerrestorepoint
}
if ($choice -eq "18") #Win Event Log
{
get-winevent -listlog *
}
if ($choice -eq "19") #Event Log
{
get-eventlog -list
}
if ($choice -eq "20") #date
{
get-date -DisplayHint date
}
if ($choice -eq "21") #Windows Product Key
{
get-windowsproductkey .
}
}