There are many different tasks that can be achieved with Windows Powershell on one line only (aka oneliner). One of this tasks is to retrieve all the largest files on all your local disks. Let's build together this script one step at the time.
First of all we have to get a list of the local hard drives. There are two ways to get a list of the drives on your local computer:
- Get-PSDrive cmdlet
- Get-WmiObject -class Win32_LogicalDisk
With Get-PSDrive all of you local and network locations are listed plus the registry, the certificate store and some other containers:
Get-PSDrive Name Used (GB) Free (GB) Provider Root ---- --------- --------- -------- ---- A FileSystem A:\ Alias Alias C 53,29 26,61 FileSystem C:\ cert Certificate \ D FileSystem D:\ E ,13 79,87 FileSystem E:\ Env Environment Function Function HKCU Registry HKEY_... HKLM Registry HKEY_... Variable Variable WSMan WSMan X 14,29 25,61 FileSystem X:\
Unfortunately the Provider (System.Management.Automation.ProviderInfo Provider) property doesn't make the difference between 'C' which is a local hard drive, and 'X', which is a network mapping. Both are reported as FileSystems.