Windows

Active Directory 中的未授權工作站

  • April 4, 2018

我是一名審計員,我發現我工作的公司中有兩個使用者擁有未經許可的 Windows 作業系統,這讓我相信可能還有其他使用者。我很想知道是否有任何方法可以提取域中尚未啟動 Windows 的所有帳戶?

是的,有多種 選擇。從 Scriptin Guys 部落格中,獲取Get-ActivationStatus程式碼片段(或函式)並嘗試如下操作:

Get-ADComputer -Filter * | Get-ActivationStatus | Export-Csv C:\Activation.csv

function Get-ActivationStatus {
[CmdletBinding()]
   param(
       [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
       [string]$DNSHostName = $Env:COMPUTERNAME
   )
   process {
       try {
           $wpa = Get-WmiObject SoftwareLicensingProduct -ComputerName $DNSHostName `
           -Filter "ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f'" `
           -Property LicenseStatus -ErrorAction Stop
       } catch {
           $status = New-Object ComponentModel.Win32Exception ($_.Exception.ErrorCode)
           $wpa = $null    
       }
       $out = New-Object psobject -Property @{
           ComputerName = $DNSHostName;
           Status = [string]::Empty;
       }
       if ($wpa) {
           :outer foreach($item in $wpa) {
               switch ($item.LicenseStatus) {
                   0 {$out.Status = "Unlicensed"}
                   1 {$out.Status = "Licensed"; break outer}
                   2 {$out.Status = "Out-Of-Box Grace Period"; break outer}
                   3 {$out.Status = "Out-Of-Tolerance Grace Period"; break outer}
                   4 {$out.Status = "Non-Genuine Grace Period"; break outer}
                   5 {$out.Status = "Notification"; break outer}
                   6 {$out.Status = "Extended Grace"; break outer}
                   default {$out.Status = "Unknown value"}
               }
           }
       } else {$out.Status = $status.Message}
       $out
   }
}

引用自:https://serverfault.com/questions/904780