Можно ли посмотреть product key ОС в PS2.0? RRS feed

  • Вопрос

  • Можно ли посмотреть product key ОС (ну и других программ) в PS2.0. Напрямую ни один командлет  не выдаёт такой информации, может как нибудь "по-хитрому" можно посмотреть, типа как с сокетом? 

    16 ноября 2012 г. 6:36


  • Скрипт - Get product keys of local and remote systems

    В случаи копроративного активирования KMS,MAC ключ получить не удасться,вместо ключа будут буквы B.

    Does Windows Product Key Viewer work with Volume License Keys (VLKs) or Multiple Activation Keys (MAKs)?

    Yes when you run Windows Product Key Viewer it will display the Volume License Key (VLK) of all versions Windows, except for Vista and 7. Microsoft changed the way VLKs are handled in these operating system. 
    Windows Vista and Windows 7 VLKs have been replaced with Multiple Activation Keys (MAKs) that either activate copies through a local Key Management Server (KMS), which in turn reports back license usage to Microsoft, or activates directly in communication with Microsoft. Currently our Windows Product Key Viewer does not report these MAKs properly. You might see our product display the Windows Vista or Windows 7 License Key as BBBBB-BBBBB-BBBBB-BBBBB-BBBBB 

    Функция из скрипта выше:

    function Get-ProductKey {
            Retrieves the product key and OS information from a local or remote system/s.
            Retrieves the product key and OS information from a local or remote system/s. Queries of 64bit OS from a 32bit OS will result in 
            inaccurate data being returned for the Product Key. You must query a 64bit OS from a system running a 64bit OS.
        .PARAMETER Computername
            Name of the local or remote system/s.
            Author: Boe Prox
            Version: 1.1       
                -Update of function from
                -Added capability to query more than one system
                -Supports remote system query
                -Supports querying 64bit OSes
                -Shows OS description and Version in output object
                -Error Handling
         Get-ProductKey -Computername Server1
        OSDescription                                           Computername OSVersion ProductKey                   
        -------------                                           ------------ --------- ----------                   
        Microsoft(R) Windows(R) Server 2003, Enterprise Edition Server1       5.2.3790  bcdfg-hjklm-pqrtt-vwxyy-12345     
            Retrieves the product key information from 'Server1'
        Param (
            [string[]]$Computername = $Env:Computername
        Begin {   
        Process {
            ForEach ($Computer in $Computername) {
                Write-Verbose ("{0}: Checking network availability" -f $Computer)
                If (Test-Connection -ComputerName $Computer -Count 1 -Quiet) {
                    Try {
                        Write-Verbose ("{0}: Retrieving WMI OS information" -f $Computer)
                        $OS = Get-WmiObject -ComputerName $Computer Win32_OperatingSystem -ErrorAction Stop                
                    } Catch {
                        $OS = New-Object PSObject -Property @{
                            Caption = $_.Exception.Message
                            Version = $_.Exception.Message
                    Try {
                        Write-Verbose ("{0}: Attempting remote registry access" -f $Computer)
                        $remoteReg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,$Computer)
                        If ($OS.OSArchitecture -eq '64-bit') {
                            $value = $remoteReg.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion").GetValue('DigitalProductId4')[0x34..0x42]
                        } Else {                        
                            $value = $remoteReg.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion").GetValue('DigitalProductId')[0x34..0x42]
                        $ProductKey = ""  
                        Write-Verbose ("{0}: Translating data into product key" -f $Computer)
                        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 
                    } Catch {
                        $ProductKey = $_.Exception.Message
                    $object = New-Object PSObject -Property @{
                        Computername = $Computer
                        ProductKey = $ProductKey
                        OSDescription = $os.Caption
                        OSVersion = $os.Version
                } Else {
                    $object = New-Object PSObject -Property @{
                        Computername = $Computer
                        ProductKey = 'Unreachable'
                        OSDescription = 'Unreachable'
                        OSVersion = 'Unreachable'

    • Помечено в качестве ответа smv0647 16 ноября 2012 г. 7:21
    16 ноября 2012 г. 6:52