好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > PowerShell小技巧之讀取Windows產品密鑰

PowerShell小技巧之讀取Windows產品密鑰

熱門標簽:騰訊地圖標注中心怎么標注 地圖標注的圖案 萬全縣地圖標注app 如何根據經緯度百度地圖標注 莫拉克電梯系統外呼怎么設置 電話機器人公司招聘 印臺區呼叫中心外呼系統 新鄭電銷機器人一個月多少錢 六寸地圖標注點怎么刪除

之前大多數人可能用過VBS讀取Windows產品密鑰的VBS腳本,VBS腳本通常都比較隱晦、難懂,今天忙里偷閑,隨手寫了一個用于讀取Windows產品密鑰的PowerShell腳本。

代碼如下:

復制代碼 代碼如下:

 =====文件名:Get-WindowsProductKey.ps1=====
function Get-WindowsProductKey([string]$computer)
{

$comments =@'
author:fuhj(powershell#live.cn ,http://fuhaijun.com)
example: Get-WindowsProductKey .
'@
$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] = '#45;'}
     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
}

Get-WindowsProductKey .

執行效果如下:

您可能感興趣的文章:
  • PowerShell小技巧之發送TCP請求
  • PowerShell小技巧之嘗試ssh登錄
  • PowerShell小技巧之執行SOAP請求
  • PowerShell腳本開發之對指定IP進行端口掃描
  • PowerShell腳本開發之收發TCP消息包
  • PowerShell腳本開發之收發UDP消息包

標簽:疫苗接種 天水 南昌 襄陽 臨汾 湘潭 喀什 汕頭

巨人網絡通訊聲明:本文標題《PowerShell小技巧之讀取Windows產品密鑰》,本文關鍵詞  PowerShell,小,技巧,之,讀取,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《PowerShell小技巧之讀取Windows產品密鑰》相關的同類信息!
  • 本頁收集關于PowerShell小技巧之讀取Windows產品密鑰的相關信息資訊供網民參考!
  • 推薦文章