Lister les Licence Terminal Server
05/01/2011
un commentaire
Ce script m’a permit de lister tous les serveurs gestionnaires de licences terminal server dans le domaine.
LSVIEW.EXE permet de faire cette recherche mais ne fouille pas recoins lointains d’un domaine important.
Le script ci-dessous est plus agressif, il vérifie la présence du service « TermServLicensing » sur tous les Windows Server du domaine.
$Input = Get-QADComputer -SizeLimit 0 | where {$_.OSName -match "Windows Server" } $expfileok = New-Item -ItemType file -Path .\TermServLicensing.csv -Force Add-Content -Path $expfileok -Value "Name,OK" foreach ($server in $Input) { $version = $null $version = Get-WmiObject Win32_OperatingSystem -ComputerName $server.name -ErrorAction SilentlyContinue If ( $version -eq $null) { Write-Host $server.name " Inaccessible." -Separator "," -ForegroundColor Red } Else { $Service = Get-Service -ComputerName $server.name -Name "TermServLicensing" -ErrorAction SilentlyContinue If ($Service.name -eq "TermServLicensing") { Write-Host $server.name "OK"-Separator "," -ForegroundColor Green Add-Content -Path $expfileok -Value "$($server.name),$("OK")" } } } |
Commentaires récents