And now for the function...

function PingServers
{
$readfile = get-content $SourceDirectory\serverlist.txt
foreach($server in $readfile)
{

$Alive = get-wmiobject win32_pingstatus -Filter "Address='$server'" |
Select-Object statuscode
if($Alive.statuscode -eq 0)
{ $Server}
else
{ }
}
}


On Wed, Feb 27, 2013 at 1:34 PM, Richard Stovall <[email protected]> wrote:

> Here's a function from a posh script I run for a completely different
> purpose that pings all the machines listed in a source text file.  Perhaps
> you could add the other things you need and do it all in powershell.
>
>
>
> On Wed, Feb 27, 2013 at 1:24 PM, David Lum <[email protected]> wrote:
>
>>  I’m looking for a ping tool that will ping a text file list of
>> hostnames and return the reply, IP address and the NetBIOS name. Here’s
>> what I currently have to do:****
>>
>> ** **
>>
>> Get list of machine names from AD, McAfee, or other systems. Ping the name
>> ****
>>
>> With the returned IP, do an NBTSTAT –A to check the NetBIOS name to see
>> if it matches the pinged host name****
>>
>> ** **
>>
>> I have to do this because frequently our VPN’d systems don’t have a
>> correct DNS entry, so some management software gets tripped up.****
>>
>> ** **
>>
>> I could do a search for free ping tools, but figured a query here might
>> save me time if someone has a tool they do that already meets this
>> requirement. Advanced IP scanner comes close, but only accepts IP’s and not
>> host names as what to ping.****
>>
>> ** **
>>
>> Ideally the output would be in a CSV format. I’m guessing PowerShell can
>> do this too?****
>>
>> *David Lum*
>> Sr. Systems Engineer // NWEATM
>> Office 503.548.5229 //* *Cell (voice/text) 503.267.9764****
>>
>> ** **
>>
>> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
>> ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>>
>> ---
>> To manage subscriptions click here:
>> http://lyris.sunbelt-software.com/read/my_forums/
>> or send an email to [email protected]
>> with the body: unsubscribe ntsysadmin
>>
>
>

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

Reply via email to