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. .EXAMPLE Get-UserProcess List all current user of the processes on the local computer. .EXAMPLE Get-UserProcess -Name explorer List specific process from current user on the local computer. #> [CmdletBinding()] param ( [string] $Name = "*" ) if ($PsVersionTable.OS -match "Windows") { $Filter = $Name.Replace("*", "%").Replace(".exe", $null) $Process = Get-CimInstance Win32_Process -Filter "Name like ""$Filter.exe""" $Process | ForEach-Object -Parallel { $GetOwnerUser = (Invoke-CimMethod -InputObject $_ -MethodName GetOwner).User if ($GetOwnerUser | Where-Object { $_ -match $env:USERNAME }) { [PSCustomObject]@{ PSTypeName = "Get-UserProcess" Name = $_.Name ProcessId = $_.ProcessId Owner = $GetOwnerUser } } } } else { Write-Warning "PSVersion OS not Windows" } } New-Alias -Name guc -Value Get-UserProcess Export-ModuleMember -Alias * -Function Get-UserProcess |