functions/Get-LargeFile.ps1

function Get-LargeFile {
    <#
    .SYNOPSIS
        Searches files exceeding the specified threshold.
     
    .DESCRIPTION
        Searches files exceeding the specified threshold.
        Scans a folder and everything beneath it.
     
    .PARAMETER Path
        The path(s) under which to search for files.
     
    .PARAMETER SizeLimit
        The maximum size a file may be without being included.
     
    .EXAMPLE
        PS C:\> Get-LargeFile -Path \\server\share -SizeLimit 2GB
 
        Returns all files under "\\server\share" that are larger than 2GB
    #>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
        [ValidateScript({
            $filePath = $_
            try { Resolve-Path -Path $filePath -ErrorAction Stop }
            catch { throw "Invalid Path: $filePath" }
        })]
        [Alias('FullName')]
        [string[]]
        $Path,

        [Parameter(Mandatory = $true)]
        [ValidateRange(1,9223372036854775807)]
        [Int64]
        $SizeLimit
    )

    process {
        # Begin & End (und Process) optional, falls kein Inhalt vorgesehen
        Write-PSFMessage -Message "Path: $Path"
        $Path | Resolve-Path | Get-ChildItem -Recurse -Force -File | Where-Object -Property Length -gt $SizeLimit
    }
}