Public/Get-BigFile.ps1
function Get-BigFile { <# .SYNOPSIS Zeigt eine Übersicht von großen Dateien und deren Besitzer. .EXAMPLE Get-BigFile -Path C:\ -GE 100MB .EXAMPLE "C:\Users", "C:\Program Files" | Get-BigFile -GE 100MB #> [CmdletBinding( HelpUri = 'https://attilakrick.com/')] [Alias("gbf")] [OutputType([PSCustomObject])] Param ( # Pfad an dem große Dateien gefunden werden sollen [Parameter(ValueFromPipeLine = $true)] [string] $Path = ".", # Eine Datei ist Groß wenn sie größer gleich diesem Wert ist [Parameter(Mandatory = $true)] [UInt32] $GE = 10MB, [switch] [bool] $Recurse = $false ) Process { Get-ChildItem -Path $Path -Recurse:$Recurse -File -Force -ErrorAction SilentlyContinue | Where-Object -Property Length -GE -Value $GE | ForEach-Object -Process { [PSCustomObject]@{ Name = $_.Name; Length = $_.Length; Owner = $_ | Get-Acl -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Owner; LastAccessTime = $_.LastAccessTime; FullName = $_.FullName; } } } } <# # ? Positive Tests Get-Help Get-BigFile -ShowWindow Show-Command Get-BigFile Get-BigFile -Path c:\ -GE 100MB -Recurse Get-BigFile -GE 100MB "C:\Users", "C:\Program Files" | Get-BigFile -GE 100MB -Recurse | Out-GridView #> |