ISW-Tools

Ping AD Computer SearchBase

Jörn Walter Veröffentlicht Aktualisiert 1 Min. Lesezeit Skripte

Powershell Ping multiple AD Computer

Welcher Computer ist Online und hat welche IP?

Ping multiple AD Computer SearchBase

Powershell anzeigen

$csv = „C:\Temp\Ping.csv“
$Computers = Get-ADComputer -Filter * -SearchBase „OU=Server,OU=Machines,OU=ORG,DC=ndsedv,DC=de“ | Select Name | Sort-Object Name
$Computers = $Computers.Name
$Headers = „ComputerName,IP Address“
$Headers | Out-File -FilePath $csv -Encoding UTF8
foreach ($computer in $Computers)
{
Write-host „Pinge $Computer“
$Test = Test-Connection -ComputerName $computer -Count 1 -ErrorAction SilentlyContinue -ErrorVariable Err
if ($test -ne $null)
{
$IP = $Test.IPV4Address.IPAddressToString
$Output = „$Computer,$IP“
$Output | Out-File -FilePath $csv -Encoding UTF8 -Append
}
Else
{
$Output = „$Computer,$Err“
$output | Out-File -FilePath $csv -Encoding UTF8 -Append
}
cls
}

Porträt Jörn Walter

Jörn Walter

Inhaber von IT-Service Walter in Euskirchen, betreut Windows-Umgebungen von Unternehmen und entwickelt die ISW-ADTools.

Alle Beiträge von Jörn Walter