Page 1 of 1

Ping Until Find

Posted: Fri Nov 17, 2017 9:31 pm
by MarvelManiac
Howdy!

I’ve recently stumbled across the job of looking for computers that we should know the location but don’t. So I’m looking to have these computer names in a text file, use get-content to ping each one until found, send ipinfo and logged on user to me via email and then remove the computer from the array, once the array count is zero, send me a final email

Are there any samples of this?

Essentially a very(very) cheap SCCM client

Thanks!!!

Re: Ping Until Find

Posted: Sat Nov 18, 2017 10:57 am
by jvierra
Here is a simple template for doing this in a loop:

Code: Select all

Get-Content servers.txt |
    ForEach-Object{
        Test-Connection $_
    }
See:
help Get-Content -Online
help Test-Connection -Online
help Send-MailMessage -Online