I am taking some information via Get-WmiObject:
$logicalDisks = Get-WmiObject -ComputerName $cmpSys Win32_LogicalDisk
Then creating some very basic HTML code to display it drive by drive:
Foreach ($disk in $logicalDisks) {
If ($disk.DriveType -eq 3) {
$disksize = [math]::round(($disk.size / 1048576))
$freespace = [math]::round(($disk.FreeSpace / 1048576))
$percFreespace=[math]::round(((($disk.FreeSpace / 1048576)/($disk.Size / 1048676)) * 100),0)
$body += @"
<font color="red">Drive Letter: </font>$($disk.DeviceID)
<br>
<font color="red">Volume Label: </font>$($disk.VolumeName)
<br>
<font color="red">FileSystem Type: </font>$($disk.FileSystem)
<br>
<font color="red">Disk Size (MB): </font>$($disksize)MB
<br>
<font color="red">Free Space (MB) / %: </font>$($freespace)MB / $($percFreeSpace)%
<br>
<br>
"@
}
}
However, this display is fairly generic, and I would like a usable report to pass on to other departments. How could I format it in a table? Something like:
DriveLetter VolumeLabel FileSystemType DiskSize Freespace %
C OS NTFS 100GB 32%
E DATA NTFS 1000GB 2%