1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
[cmdletbinding()]
param (
[parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
[string[]]$ComputerName = $env:computername
)
begin {}
process {
foreach ($Computer in $ComputerName) {
get-wmiobject -computer $computer win32_logicaldisk | where {$_.drivetype -eq 3} | tee-object -variable disques |
Format-Table @{e={$_.systemname};n="Système " },
@{e={$_.name};n="Disque"},
@{e={[math]::round($_.size/1GB,2)};n="Capacité (Go)"},
@{e={[math]::round($_.freespace/1GB,1)};n="Disponible (Go)"},
@{e={[math]::round(([int64]$_.freespace/[int64]$_.size*100),0)};n="(%)"}
}
}
end {} |