X-Git-Url: https://us-delaporte.pagekite.me/gitweb/dotfiles.git/blobdiff_plain/7f8534a0ad54e854ab4d70b0bd45e2c05369aece..b20ef19dfb5a70d582c21207a60d97ff378778f9:/psmodules/drivespace.psm1?ds=sidebyside diff --git a/psmodules/drivespace.psm1 b/psmodules/drivespace.psm1 index 47072d8..342311b 100644 --- a/psmodules/drivespace.psm1 +++ b/psmodules/drivespace.psm1 @@ -5,7 +5,10 @@ Find 10 largest files on the C drive. #> function Show-LargeFiles() { - Get-ChildItem c:\ -r| sort -descending -property length | select -first 10 name, Length, FullName + param( + [int]$Max=10 + ) + Get-ChildItem c:\ -r| sort -descending -property length | select -first $Max name, Length, FullName } <# @@ -15,7 +18,26 @@ Display the free space on the C drive. #> function Show-Drivespace() { - Get-PSDrive C | Select-Object Used,Free + Get-PSDrive C | Select-Object Used,Free | ForEach { + Write-Host "Free space GB: " ($_.Free / 1GB) + Write-Host "Used space GB: " ($_.Used / 1GB) + } +} + +function Show-DrivespacePretty() { + Start-Job -Name "FileCollection" -ScriptBlock { Show-Drivespace } +While((Get-Job -Name "FileCollection").State -eq "Running") { + Write-Progress -Activity "Collecting Files..." -PercentComplete $x + If($x -eq 100){ + $x = 1 + } + Else{ + $x += 1 + } +} +Write-Progress -Activity "Collecting Files..." -Completed +$Files = Get-Job -Name "FileCollection" | Receive-Job +Get-Job -Name "FileCollection" | Remove-Job } Export-ModuleMember -Function Show-Drivespace