Speed up Test-Connection before Foreach

后端 未结 2 1437
萌比男神i
萌比男神i 2021-01-07 03:38

I made a script to check if users desktop folder are under the cuota limitation, if they\'re under the cuota limitation the backup to the server will be done correctly.

2条回答
  •  抹茶落季
    2021-01-07 03:58

    test-connection is weirdly fast with the -asjob parameter, pinging about 200 computers in 4 seconds:

    $list = cat hp.txt
    test-connection $list -AsJob ; job | receive-job -wait -AutoRemoveJob
    

提交回复
热议问题