Wednesday 25 September 2013

Get product keys of Local and Remote systems


If you want to find MS OS Key for a single computer or multiple computers in a domain ,follow the below procedure.

1. Download the script from below Microsoft website

       http://gallery.technet.microsoft.com/Get-product-keys-of-local-83b4ce97

2. Copy Get-ProductKey.ps1 file to one of the folder in C Drive.In my case I have created scripts folder in      C Drive
3. Open PowerShell with Run as administrator
    Run below command:  
                         Import-Module C:\scripts\Get-ProductKey.ps1

   Note: If you are using 64 bit OS you will get below error

Import-Module : File C:\scripts\Get-ProductKey.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ Import-Module C:\scripts\Get-ProductKey.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [Import-Module], PSSecurityException

    + FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand

   Please run below command to resolve above issue
                         Set-ExecutionPolicy Unrestricted



4. Run below command to get the key
                        Get-ProductKey -Computername xxxxxx

        (xxxxx is the computername)


   If you want get the more computer keys use comma symbol
                       Get-ProductKey -Computername xxxxxx,yyyyyy,zzzzzz

No comments:

Post a Comment