Ping a list of host names and output the results to a csv in powershell

后端 未结 4 1881
一生所求
一生所求 2020-12-16 07:52

I have a large list of hostnames I need to ping to see if they are up or down. I\'m not really that great at scripting but I managed to figure this much out:



        
4条回答
  •  独厮守ぢ
    2020-12-16 08:38

    I would do it this way. Using a list of computers and -asjob works very well. The Responsetime property will be non-null if the host is up.

    $names = Get-content hnames.txt
    test-connection $names -asjob -count 1 | recieve-job -wait -auto
    

提交回复
热议问题