2
4

2 回答 2

0

我建议使用 PSRemoting 而不是使用远程注册表。假设已设置好,您所要做的就是:

$computers = @('localhost')#list of computers
#unless you are currently logged in as a domain admin
# you will need to provide credentials
$cred = Get-Credential domain\administrator 
Invoke-Command -Credential $cred  -ComputerName $computers -ScriptBlock {
function Get-ProductKey{ 
       #from http://gallery.technet.microsoft.com/scriptcenter/Get-product-keys-of-local-83b4ce97
    }
get-ProductKey
}| ft Computername,OSDescription,OSVersion,ProductKey

这将打印出以下输出:

Computername                  OSDescription                 OSVersion                     ProductKey
------------                  -------------                 ---------                     ----------
%name%                        Microsoft Windows 8 Pro       6.2.9200                      XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
于 2013-08-25T16:27:38.257 回答
0

我通过powershell使用了以下命令,以管理员身份运行:

wmic /user:jc1_admin /node:pc00202 os get "SerialNumber"
于 2017-09-13T16:30:28.453 回答