Powershell: Get-Process() does not show full UserName

Created on 16 Feb 2020  路  2Comments  路  Source: PowerShell/PowerShell

Steps to reproduce

Get some VM to run and in a admin command prompt run "tasklist -v | qgrep vmwp" and you get the output as:
vmwp.exe                     10732 Services                   0     29,224 K Unknown         NT VIRTUAL MACHINE\BF292885-D4DF-4CD9-8F8C-653E8D5      0:41:22 N/A 
Please note after NT VIRTUAL MACHINE\ you get the actual GUID
Now in a admin powershell do: Get-Process vmwp -IncludeUsrName and you get:
617      29224 2,485.05  10732 NT VIRTUAL MACHINE\... vmwp
# Expected behavior
617      29224 2,485.05  10732 NT VIRTUAL MACHINE\BF292885-D4DF-4CD9-8F8C-653E8D5 vmwp
How do I get the actual GUID and not get that "..."
I tried all possible options but I could not get the actual GUID got only the "..."
```none
Please help
Thanks
ananda

Actual behavior


Environment data


PS C:UsersAdministratorHvRdtTool> $PSVersionTable

Name Value
---- -----
PSVersion 5.1.17763.1
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1


Issue-Question

All 2 comments

The truncation and the ... are just the formatter telling you that there isn't enough room in the console screen with the predefined formats to show the full data.

You can retrieve just the user name in a number of ways:

(Get-Process vwmp -IncludeUserName).UserName

Get-Process vwmp -IncludeUserName | Select-Object -ExpandProperty UserName

Get-Process vwmp -IncludeUserName | ForEach-Object -MemberName UserName

$process = Get-Process vwmp -IncludeUserName
$process.UserName

If you need a more thorough run through some of the PowerShell essentials, I can highly recommend reading through the about_* help topics: Get-Help about_* will give you the full list; enter any of the full topic names you're interested in to the Get-Help command to read them.

There's also my project PSKoans if you prefer a more interactive approach. 馃檪

Wow!! Thanks for the help and another thanks for the prompt reply that too over the weekend. Really appreciate it. I did try all the help possible but none talked about the ExapandProperty!! That was the critical part. I knew the ... meant it is hidden ... thanks again
Get-Process vmwp -IncludeUserName | Format-List -Property UserName,Id,CPU,PriorityClass
This gave me all the info I needed in i line!! Brilliant!!

Was this page helpful?
0 / 5 - 0 ratings