Accueil > Windows > Pinger un ordinateur avec un script Powershell.

Pinger un ordinateur avec un script Powershell.

Faire un ping d’un ordinateur.
Permet vérifier que l’ordinateur est en ligne avant de lancer une action sur lui via un script.

$computername = Read-Host "Please enter the computer name"
$ping = new-object System.Net.NetworkInformation.Ping
$reply = $ping.send($computerName)
if ($reply.status –eq “Success”)
write-host "$ComputerName is online."
Categories: Windows Tags: , ,

Vous avez aimé cet article ? Alors partagez-le en cliquant sur les boutons ci-dessous :

Twitter Facebook Google Plus Linkedin

Article rédigé par Christophe Bluteau.

  1. 25/11/2016 à 19:31 | #1

    That insight’s perfect for what I need. Thanks!

  2. 27/03/2017 à 15:12 | #2

    You're an optimist, Delaware Watch.I think we've pretty much doomed all higher (multi-cellular) living things to extinction and will ultimately leave behind a planet utterly contaminated by deadly levels of radioactivity.Evolution cannot happen when genes are constantly bombarded by radiation. Perhaps some single cell creatures living deep beneath the earth will eventually emerge to begin the evolutionary process again after the millions of years that will be required for the radioactive isotopes like plutonium to disappear.Have a good day.anonone

  1. Pas encore de trackbacks