-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisktally.ps1
More file actions
19 lines (17 loc) · 787 Bytes
/
disktally.ps1
File metadata and controls
19 lines (17 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$savePath = "$env:SYSTEMDRIVE\temp"
$Computers = Get-Content $savePath\servers.txt
$Output = @()
Foreach ($Computer in $Computers)
{
$Output += Get-WmiObject Win32_Volume -Filter "DriveType='3'" -ComputerName $Computer | ForEach {
New-Object PSObject -Property @{
Name = $_.Name
Label = $_.Label
Computer = $Computer
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))
}
}
}
$Output | Export-Csv -NoTypeInformation -Path $savePath\diskSpace.csv