Server Volume Size (Powershell)

Creates an HTML File with all the Volumes in your Server (Name and Size) - Work on Windows 2003 Server and above.


Download Script


 


##########################
# Created By Assaf Miron #
# Server Volume Size.ps1 #
##########################

$CompName = HOSTNAME
$Header = "<h1>Volume Information on "+$CompName+"</h1>"
$CSS = @"<style type=`"text/css`">
TABLE{
    direction:LTR;
    border-collapse:collapse;
    border-style: solid;
    border-width: 1px;
    border-Color: Black;
    font-family: Calibri;
}
td{
    direction: LTR;
    border-style: solid;
    border-width: 1px;
    border-Color: Black;
    font-family: Calibri;
}
th{
    border-style: solid;
    border-width: 1px;
    border-color: Black;
}
</style>"

Get-WmiObject Win32_Volume |
    select DriveLetter,Name,FileSystem,Label,@{Expression={($_.Capacity/1GB).tostring("##,##.# GB")};Name="Volume Capacity(GB)"},@{Expression={($_.FreeSpace/1GB).toString("##,##.# GB")};Name="Free Space(GB)"} |
    Sort Label | ConvertTo-Html -body $Header -Head $CSS"<Title>"$CompName"</Title>" | out-file C:\$CompName-Volumes.html

Comments