-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcheck logical space.ps1
49 lines (48 loc) · 2.46 KB
/
check logical space.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
$LogicalDisks = Get-WMIObject Win32_LogicalDisk
$LocalHDisks = $LogicalDisks | Where-Object { $_.DriveType -eq 3 }
$RemoteDrives = Get-WMIObject Win32_LogicalDisk | Where-Object { $_.DriveType -eq 4 }
$OpticalDrives = Get-WMIObject Win32_CDRomDrive
$LocalHDisks | ft -auto @{Label="Drive";`
Expression={$_.DeviceID};
width=5
align="Right"},`
@{Label="Volume Label";`
Expression={$_.VolumeName};
Width=25},`
@{Label="%Free";`
Expression={[int]($_.FreeSpace/$_.Size * 100)};`
Width=8},`
@{Label="GBFree";`
Expression={$([math]::round(($_.FreeSpace/1gb),0))};`
Width=8},`
@{Label="Size(GB)";`
Expression={$([math]::round(($_.Size/1gb),0))};`
Width=8}
$OpticalDrives | Sort Drive | ft -auto `
@{Label="Drive";`
Expression={$_.Drive};`
Width=5
Align="Right"},
@{Label="Capabilities";`
Expression={ if ($_.Capabilities -eq 4) { `
"Read/Write" `
} else { `
"Read-Only"}}},`
@{Label="Disk Volume Label";`
Expression={$_.VolumeName}}
$RemoteDrives | ft -auto @{Label="Drive";`
Expression={$_.DeviceID};`
width=5
align="Right"},`
@{Label="Remote Share";`
Expression={$_.ProviderName};`
Width=25},
@{Label="%Free";`
Expression={[int]($_.FreeSpace/$_.Size * 100)};`
Width=8},`
@{Label="GBFree";`
Expression={$([math]::round(($_.FreeSpace/1gb),0))};`
Width=8},`
@{Label="Size(GB)";`
Expression={$([math]::round(($_.Size/1gb),0))};`
Width=8}