Private/Get-uAProcessDetails.ps1

function Get-uAProcessDetails {
    [CmdletBinding()]
    param (
        # process name
        [Parameter(Mandatory = $true)]
        [string]
        $ProcessName
    )
    $owners = @()
    $ProcessNameExt = $ProcessName + '.exe'
    
    Get-CimInstance Win32_Process -Filter "name = '$ProcessNameExt'" | ForEach-Object {
       $Owner = (Invoke-CimMethod -InputObject $_ -MethodName GetOwner).user
       $Id = $_.Handle
       
       $Properties = @{Name = "$ProcessName"; Id = $Id; Owner = "$Owner"}
       $Newobject = New-Object PSObject -Property $Properties
       $owners += $Newobject
    }
    
    return $owners
}
# SIG # Begin signature block
# MIIRVgYJKoZIhvcNAQcCoIIRRzCCEUMCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCB2+R/wHDN24vrr
# /eg1dBp0U3zVWe5B5erfSbMw4x/RVKCCDW0wggZyMIIEWqADAgECAghkM1HTxzif
# CDANBgkqhkiG9w0BAQsFADB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
# EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8G
# A1UEAwwoU1NMLmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTAe
# Fw0xNjA2MjQyMDQ0MzBaFw0zMTA2MjQyMDQ0MzBaMHgxCzAJBgNVBAYTAlVTMQ4w
# DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjERMA8GA1UECgwIU1NMIENv
# cnAxNDAyBgNVBAMMK1NTTC5jb20gQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBD
# QSBSU0EgUjEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCfgxNzqrDG
# bSHL24t6h3TQcdyOl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