any idea how to output this to a file ?
$servers = get-content "c:\scripts\servers.txt"
Foreach ($server in $servers) {
Get-WmiObject Win32_Volume -ComputerName $server| ForEach {
New-Object PSObject -Property @{
Computername = $server
Name = $_.Name
Label = $_.Label
FreeSpace_GB = ([Math]::Round($_.FreeSpace /1GB,2))
TotalSize_GB = ([Math]::Round($_.Capacity /1GB,2))
UsedSpace_GB = ([Math]::Round($_.Capacity /1GB,2)) - ([Math]::Round($_.FreeSpace /1GB,2))
blocksize = $_.blocksize
filesystem = $_.filesystem
}
} ft -autosize | export-csv "test.csv"}
this only gives me the last server output not everything