4 Find 10 largest files on the C drive.
7 function Show-LargeFiles() {
11 Get-ChildItem c:\ -r| sort -descending -property length | select -first $Max name, Length, FullName
17 Display the free space on the C drive.
20 function Show-Drivespace() {
21 Get-PSDrive C | Select-Object Used,Free | ForEach {
22 Write-Host "Free space GB: " ($_.Free / 1GB)
23 Write-Host "Used space GB: " ($_.Used / 1GB)
27 function Show-DrivespacePretty() {
28 Start-Job -Name "FileCollection" -ScriptBlock { Show-Drivespace }
29 While((Get-Job -Name "FileCollection").State -eq "Running") {
30 Write-Progress -Activity "Collecting Files..." -PercentComplete $x
38 Write-Progress -Activity "Collecting Files..." -Completed
39 $Files = Get-Job -Name "FileCollection" | Receive-Job
40 Get-Job -Name "FileCollection" | Remove-Job
43 Export-ModuleMember -Function Show-Drivespace
44 Export-ModuleMember -Function Show-LargeFiles