Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

How to wrap a powershell command in to an IF statement

$
0
0

Hello, I'm starting to learn Powershell.  I have found this command on the internet and it works very well.  I'm loving Powershell.

Get-WmiObject win32_logicaldisk -filter "drivetype=3" -computer (Get-Content "c:\scripts\computers.txt") |
Select Systemname,DeviceID,VolumeName,@{Name="size(GB)";Expression={"{0:N2}" -f($_.size/1gb)}},@{Name="freespace(GB)";Expression={"{0:N1}" -f($_.Freespace/1gb)}} |
out-gridview

I would like to know how to best change this to first check and see if the computer is online and if not list it in outgrid as offline?

v/r

john


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>