Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

get-process and UserName

$
0
0
Hi,
I'm trying to list all/some process and need to include the username since the script has to run in a terminal server environment. It works using WMI (Get-WmiObjectWin32_Processand GetOwner()) but get-process provides some more attributes I need to export to  a logfile.

Accoring to MSDN there is a property called UserName in the StartInfo object, but the value is always empty, when executing this script:

get-process

outlook | select-object id, path, @{Name="UserName";Expression = {$_.StartInfo.UserName}}

What's wrong? I am fairly new to PS, so is this the correct way of reading that property?


Thanks, regards

Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>