Link to home
Start Free TrialLog in
Avatar of R W
R WFlag for United States of America

asked on

Pinging computers in AD

Over the last few months the techs have become lazy and not moved computers to the correct OU which makes software updating a pain since they could be in other offices. I am looking for a script, powershell or program that pings computers and it reports back the IP so I can see if its in the right place or not.
Avatar of Scott C
Scott C
Flag of United States of America image

You might need something with a little more "intelligence" than PowerShell.

You could try What's UP! Gold or Network Detective.

http://www.whatsupgold.com/

http://www.rapidfiretools.com/nd_overview.php

These two will do an active scan of your network and let you know what is out there.
ASKER CERTIFIED SOLUTION
Avatar of Zephyr ICT
Zephyr ICT
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Below is a script that you can use for what you are asking for...

Save the blow script as a filename.ps1 file extension
$Computers = Get-Content "c:\computers.txt"
ForEach ($Computer in $Computers) 
    {
        
        $PING = Test-Connection -ComputerName $Computer -Quiet -Count 1

        If ($PING -eq $True)
            {

            Write-Output "$Computer is pingable"

            }

       Else {

            Write-Warning "$Computer NOT PINGABLE!"

            }
            

}

Open in new window


Or if you just wanted to Query ALL computers in your Active Directory environment you can use the following script below rather than from a text file.
Import-Module ActiveDirectory
$Computers = Get-ADComputer -Filter * -Properties Name, IPv4Address
ForEach ($Computer in $Computers) 
    {
        
        $PING = Test-Connection -ComputerName $Computer.Name -Quiet -Count 1

        If ($PING -eq $True)
            {

            Write-Output "$Computer.Name $Computer.IPv4Address is pingable"

            }

       Else {

            Write-Warning "$Computer.Name $Computer.IPv4Address NOT PINGABLE!"

            }
            

}

Open in new window



WIll.