PowerShell İle İşletim Sistemine Göre AD Bilgisayar Sayılarını Bulma
Aşağıdaki powershell scripti ile yukarıdaki ekran görüntüsünde göründüğü gibi bilgisayar sayıları kolaylıkla elde edilebilir.
# Import AD module
Import-Module ActiveDirectory
# Domain adını bulma
$DomainName = (Get-ADDomain).NetBIOSName
# Kaç gün öncesine kadar oturum açmış makineleri sorgula
$days = 30
$lastLogonDate = (Get-Date).AddDays(-$days).ToFileTime()
# AD sorgulama
$Computers = @(Get-ADComputer -Properties Name,operatingSystem,lastLogontimeStamp -Filter {(OperatingSystem -like "*Windows*") -AND (lastLogontimeStamp -ge $lastLogonDate)})
foreach($Computer in $Computers)
{
$Computer.OperatingSystem = $Computer.OperatingSystem -replace '®' -replace '™' -replace '专业版','Professional (Ch)' -replace 'Professionnel','Professional (Fr)'
}
$Computers | Group-Object operatingSystem | Select Count,Name | Sort Name | Out-GridView

Yorumlar