1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| $computerliste = @("srv-db-int","srv-kim-int")
# via une variable
$i = foreach ($computer in $computerliste ) {
get-wmiobject -computer $computer win32_logicaldisk | where {$_.drivetype -eq 3} | tee-object -variable disques |
select @{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="(%)"}
}
$i | ft
# ou via un foreach par pipeline
$computerliste | foreach {
get-wmiobject -computer $_ win32_logicaldisk | where {$_.drivetype -eq 3} | tee-object -variable disques |
select @{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="(%)"}
} | ft |
Partager