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

主頁(yè) > 知識(shí)庫(kù) > PowerShell小技巧之讀取Windows產(chǎn)品密鑰

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

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

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

代碼如下:

復(fù)制代碼 代碼如下:

 =====文件名: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請(qǐng)求
  • PowerShell小技巧之嘗試ssh登錄
  • PowerShell小技巧之執(zhí)行SOAP請(qǐng)求
  • PowerShell腳本開發(fā)之對(duì)指定IP進(jìn)行端口掃描
  • PowerShell腳本開發(fā)之收發(fā)TCP消息包
  • PowerShell腳本開發(fā)之收發(fā)UDP消息包

標(biāo)簽:疫苗接種 天水 南昌 襄陽(yáng) 臨汾 湘潭 喀什 汕頭

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《PowerShell小技巧之讀取Windows產(chǎn)品密鑰》,本文關(guān)鍵詞  PowerShell,小,技巧,之,讀取,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《PowerShell小技巧之讀取Windows產(chǎn)品密鑰》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于PowerShell小技巧之讀取Windows產(chǎn)品密鑰的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 东乌珠穆沁旗| 尼勒克县| 芜湖市| 武强县| 宣武区| 扎鲁特旗| 绩溪县| 灯塔市| 桂林市| 永城市| 新昌县| 沁阳市| 天等县| 平阴县| 柘城县| 乐亭县| 泰顺县| 哈巴河县| 玛曲县| 巴中市| 太和县| 陆良县| 翁牛特旗| 博罗县| 滦平县| 滨海县| 璧山县| 聊城市| 靖江市| 法库县| 云霄县| 鄂尔多斯市| 云林县| 沁水县| 永胜县| 大丰市| 盱眙县| 镇雄县| 九寨沟县| 象山县| 江口县|