婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > PowerShell小技巧之讀取Windows產(chǎn)品密鑰

PowerShell小技巧之讀取Windows產(chǎn)品密鑰

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

之前大多數(shù)人可能用過VBS讀取Windows產(chǎn)品密鑰的VBS腳本,VBS腳本通常都比較隱晦、難懂,今天忙里偷閑,隨手寫了一個用于讀取Windows產(chǎn)品密鑰的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 .

執(zhí)行效果如下:

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

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

巨人網(wǎng)絡通訊聲明:本文標題《PowerShell小技巧之讀取Windows產(chǎn)品密鑰》,本文關(guān)鍵詞  PowerShell,小,技巧,之,讀取,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《PowerShell小技巧之讀取Windows產(chǎn)品密鑰》相關(guān)的同類信息!
  • 本頁收集關(guān)于PowerShell小技巧之讀取Windows產(chǎn)品密鑰的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 阳原县| 瑞昌市| 莱西市| 晋宁县| 大埔县| 黄平县| 河东区| 靖安县| 临湘市| 南澳县| 成安县| 屏山县| 保亭| 宁化县| 抚宁县| 防城港市| 漳州市| 蒲江县| 平南县| 湟中县| 连南| 达尔| 广南县| 南江县| 吉水县| 宜黄县| 泸西县| 江川县| 沅陵县| 濉溪县| 汤原县| 昭苏县| 武定县| 锡林浩特市| 望奎县| 平顺县| 霞浦县| 尚义县| 准格尔旗| 胶州市| 伊金霍洛旗|