]> us-delaporte.pagekite.me Git - dotfiles.git/blob - psmodules/drivespace.psm1
Add wsl.conf
[dotfiles.git] / psmodules / drivespace.psm1
1 <#
2 .SYNOPSIS
3
4 Find 10 largest files on the C drive.
5
6 #>
7 function Show-LargeFiles() {
8 param(
9 [int]$Max=10
10 )
11 Get-ChildItem c:\ -r| sort -descending -property length | select -first $Max name, Length, FullName
12 }
13
14 <#
15 .SYNPOSIS
16
17 Display the free space on the C drive.
18
19 #>
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)
24 }
25 }
26
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
31 If($x -eq 100){
32 $x = 1
33 }
34 Else{
35 $x += 1
36 }
37 }
38 Write-Progress -Activity "Collecting Files..." -Completed
39 $Files = Get-Job -Name "FileCollection" | Receive-Job
40 Get-Job -Name "FileCollection" | Remove-Job
41 }
42
43 Export-ModuleMember -Function Show-Drivespace
44 Export-ModuleMember -Function Show-LargeFiles