external help file | Module Name | online version | schema |
---|---|---|---|
ComputerManagement-help.xml |
ComputerManagement |
2.0.0 |
Get the disk usage of a given path
Get-DiskUsage [[-Path] <String>] [<CommonParameters>]
This function returns the disk usage of a given path
Get-DiskUsage -Dir c:\
FolderName FolderSize
---------- ----------
C:\dcam 204
C:\DPMLogs 1166251
C:\inetpub 0
C:\PerfLogs 0
C:\Program Files 504195070
C:\Program Files (x86) 2747425666
C:\repository 10294506
C:\SCRATCH 0
C:\scripts 2218148
C:\TEMP 0
C:\Trail 0
C:\Users 16198918163
C:\Windows 18163280116
This shows the basic syntax of the command
Get-DiskUsage -Dir c:\ |Sort-Object -Property FolderSize
FolderName FolderSize
---------- ----------
C:\SCRATCH 0
C:\Trail 0
C:\TEMP 0
C:\PerfLogs 0
C:\inetpub 0
C:\dcam 204
C:\DPMLogs 1166251
C:\scripts 2218148
C:\repository 10294506
C:\Program Files 504195070
C:\Program Files (x86) 2747425666
C:\Users 16198918163
C:\Windows 18163345365
This example shows piping the output through Sort-Object
The path to check
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: .
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
FunctionName : Get-DiskUsage Created by : jspatton Date Coded : 03/21/2012 10:29:24
If you don't have access to read the contents of a given folder the function returns 0.