Get-UserProcess.psm1

function Get-UserProcess {
    <#
.SYNOPSIS
    The Get-UserProcess cmdlet gets current user processes on a local computer.
    Without parameters, this cmdlet gets all current user of the processes on the local computer.
.DESCRIPTION
    The Get-UserProcess cmdlet gets current user processes on a local computer.
    Without parameters, this cmdlet gets all current user of the processes on the local computer.
.PARAMETER Name
    Name of specific process from current user on the local computer.
.PARAMETER Force
    Disable the built-in Format-Table and Sort-Object.
.EXAMPLE
    Get-UserProcess
    List all current user of the processes on the local computer with built-in Format-Table and Sort-Object.
.EXAMPLE
    Get-UserProcess -Force
    List all current user of the processes on the local computer and disable built-in Format-Table and Sort-Object.
.EXAMPLE
    Get-UserProcess -Name explorer
    List specific process from current user on the local computer with built-in Format-Table and Sort-Object.
.EXAMPLE
    Get-UserProcess -Name explorer -Force
    List specific process from current user on the local computer and disable the built-in Format-Table and Sort-Object.
#>

    [cmdletbinding()]
    param (
        [parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
        [string]$Name = "*",
        [switch]$Force
    )
    $UN = $env:USERNAME
    $UP1 = ".exe"
    $UP2 = $Name.Replace("*", "%").Replace($UP1, "")
    $UP3 = Get-CimInstance Win32_Process -Filter "Name like ""$UP2$UP1"""
    $UP4 = $UP3 | Select-Object Name, ProcessId, @{Label = "Owner"; Expression = {($_ | Invoke-CimMethod -MethodName GetOwner).User}} | Where-Object {$_.Owner -match $UN}
    if ($Force) {$UP4} else {$UP4 | Sort-Object -Property Name | Format-Table -AutoSize} # Output
}