Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Output to 2 files with 1 command?

$
0
0

I have this code that works:

 

gc C:\Tools\PingComputers\Input.txt |?{ (gwmi Win32_PingStatus -Filter "Address='$_'").StatusCode -eq 0 } | out-file C:\Tools\PingComputers\Pingable.txt

 

 

How would I also create a .txt file of the machines that it CAN'T ping?

 

Also, I don't understand what the question mark does.  How is it used in this code?


Viewing all articles
Browse latest Browse all 6937

Trending Articles