Bulk Domain Ping with Powershell

Powershell scripting ile işi hızlandirip birden fazla domainin hangi IP’yi cozdugunu ve ping’e cevap verip vermedigini tespit edebiliriz.

Kısaca Powershell Nedir?
Microsoft’un .Net Framework destekli gelistirdigi en kapsamlı shell konsoludur. Powershell uzerinde  .net tabanlı scripting calistirma imkanı bulabiliyorsunuz.

“Bulk Domain Ping” betigine ait ilgili kodları  asağıda paylaşıyorum.

$readfile=get-content “C:\Users\root\Desktop\servers.txt
foreach($readf in $readfile)
{
$ALive=get-wmiobject win32_pingstatus -Filter “Address=’$readf’” | Select-Object statuscode
if($ALive.statuscode -eq 0)
{write-host $readf is REACHABLE -background “GREEN” -foreground “BLACk”}

else

{
write-host $readf is NOT reachable -background “RED” -foreground “BLACk”}

}

Domain listesinin path’ini belirmeniz ve Powershell konsolu açıp yukaridaki kodlari calıştımanız gerekcektir.

Ping’e cevap veren domainler REACHABLE , pinge cevap vermeyen domainler ise NOT REACHABLE şeklinde konsola yansıyacaktır.

Detaylar:

http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx

http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx

 

Share on Facebook

Leave a Reply

Your email address will not be published. Required fields are marked *

*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>