I am fairly new to Powershell scripting and I have a task that I need to achieve every week for a large list of clients.
I am looking at outputting the storage usage/capacity on each server.
Get-WmiObject -Class Win32_logicaldisk -Filter "DriveType = '3'" |
Select-Object -Property DeviceID,
@{L='FreeSpaceGB';E={"{0:N2}" -f ($_.FreeSpace /1GB)}},
@{L="Capacity";E={"{0:N2}" -f ($_.Size/1GB)}}
The above code does what I want, however it outputs it like this:
DeviceID FreeSpaceGB Capacity
-------- ----------- --------
C: 74.91 231.72
I was hoping it to look more like:
C: 74.91GB/231.72GB
Is it possible to use Select-String to select the output of the above code, and then use that string to give the output I want?