Skip to content

Instantly share code, notes, and snippets.

@janegilring
Created May 16, 2013 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janegilring/5594894 to your computer and use it in GitHub Desktop.
Save janegilring/5594894 to your computer and use it in GitHub Desktop.
Entry from the 2013 Scripting Games Beginner Event 3, reviewed at blog.powershell.no
Get-CimInstance -ClassName Win32_LogicalDisk -ComputerName localhost -Filter 'DriveType = 3' -Property DeviceID,Size,FreeSpace |
Select-Object -Property @{Name="Drive";Expression={$_.DeviceID}},
@{Name="Size(GB)";Expression={"{0:N2}" -f ($_.Size/1GB)}},
@{Name="FreeSpace(MB)";Expression={"{0:N2}" -f ($_.FreeSpace/1MB)}} |
ConvertTo-Html -Property Drive,'Size(GB)','FreeSpace(MB)' `
-Head "<title>Disk Free Space Report</title><h2>Local Fixed Disk Report</h2>" `
-PostContent "<hr>",(Get-Date) |
Out-File C:\temp\LocalDrivesOnServer.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment