Public/Get-InactiveUser.ps1

Function Get-InactiveUser {
    <#
        .Synopsis
            Lists inactive ActiveDirectory accounts
        .Description
            Lists ActiveDirectory accounts that have been inactive over a given timespan, lists only enabled accounts
        .Parameter timespan
            Number of days accounts have been inactive
        .Example
            Get-InactiveUser -TimeSpan 180
            Lists accounts that have not been active for 180 days
        .Inputs
            Integer
        .LINK
            about_functions_advanced
        .LINK
            about_CommonParameters
    #>

    [CmdletBinding(
        SupportsPaging = $true
    )]
    [OutputType('Microsoft.ActiveDirectory.Management.ADAccount')]
    Param (
        [Parameter(
            Mandatory = $true,
            ValueFromPipeline = $true,
            HelpMessage = 'Provide number of days accounts have been inactive'
        )]
        $TimeSpan
    )

    Begin {
        $PSBoundParameters.AccountInactive = $true
        $PSBoundParameters.UsersOnly = $true
    }
    Process {
        Try {
            $Search = Search-ADAccount @PSBoundParameters
        } Catch {
            Write-Warning $_.Exception.Message
        }
    }
    End {
        Return $Search
    }
}
Set-Alias -Name Find-InactiveUser -Value Get-InactiveUser -Description "Get Inactive User Accounts" -Option ReadOnly -PassThru -ErrorAction SilentlyContinue