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

Convert Hard Drive Results to a HTML report and send it in email

$
0
0

 

 

$a = "<style>"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color:black;}"
$a = $a + "Table{background-color:#DFFFFF;border-collapse: collapse;}"
$a = $a + "TH{border-width:1px;padding:0px;border-style:solid;border-color:black;}"
$a = $a + "TD{border-width:1px;padding-left:5px;border-style:solid;border-color:black;}"
$a = $a + "</style>"

Get-WmiObject Win32_logicaldisk -Filter "DriveType=3" -ComputerName localhost | Select-Object SystemName, Deviceid, @{ Name = "Size (GB)"; Expression = {"{0:N0} GB" -f ($_.size / 1GB) } },@{ Name = "Free Space (GB)"; Expression = { "{0:N0} GB" -f ($_.freespace / 1GB) } },@{ Name = "Free Space (%)"; Expression = { "{0:P2} GB" -f (($_.freespace / 1GB) / ($_.size / 1GB)) } } | ft -AutoSize | ConvertTo-Html -head $a | Out-File DriveSpace.htm


Viewing all articles
Browse latest Browse all 6937

Trending Articles