开PowerShell控制台(管理员身份运行)。
用这个PowerShell脚本:
Import-Module ActiveDirectory
$Computers = Get-ADComputer -Filter * -Property *
foreach ($Computer in $Computers) {
$ComputerName = $Computer.Name
$OSVersion = Invoke-Command -ComputerName $ComputerName -ScriptBlock { (Get-WmiObject -Class Win32_OperatingSystem).Caption }
$ActivationStatus = Invoke-Command -ComputerName $ComputerName -ScriptBlock { (cscript //Nologo slmgr.vbs /dli | Out-String) -match "License Status: (.*)" }
if ($ActivationStatus -match "Licensed") {
$ActivationStatus = "Activated"
} else {
$ActivationStatus = "Not Activated"
}
[PSCustomObject]@{
ComputerName = $ComputerName
OSVersion = $OSVersion
ActivationStatus = $ActivationStatus
}
}