码迷,mamicode.com
首页 > 系统相关 > 详细

PowerShell中显示进程所属用户

时间:2015-04-24 18:20:49      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:

 
 

首先,以管理员身份打开PowerShell。

输入:

get-process -includeusername | format-table -autosize

显示如下:

Handles  WS(K) VM(M)    CPU(s)   Id UserName                                                ProcessName
-------  ----- -----    ------   -- --------                                                -----------
    445  18968   290  1,836.91 2944 HOMEPC\Raymond                                          Agent
     92   2384    26      0.02 2336 NT AUTHORITY\LOCAL SERVICE                              alg
    253   7304    85      0.39 6480 HOMEPC\Raymond                                          alicnotify
    380   7916    82    549.81 1656 NT AUTHORITY\SYSTEM                                     AlipaySecSvc
    183   4228   102     19.34 3308 NT AUTHORITY\SYSTEM                                     atieclxx
    128   2288    26      0.05  896 NT AUTHORITY\SYSTEM                                     atiesrxx
    176  11296    70      0.19 6488                                                         audiodg
    720   6920   295    255.91 5268 HOMEPC\Raymond                                          baiduyun
    845  65676   383  8,915.66 2316 HOMEPC\Raymond                                          BaiduYunGuanjia
    929 155600   572  3,104.13 5628 HOMEPC\Raymond                                          Battle.net
   1322  15560   168      2.53 7592 HOMEPC\Raymond                                          BingIMEPlatform
     75   2308    24      0.11 1740 NT AUTHORITY\SYSTEM                                     BingIMEUpdateService
     95   2892    82      0.69 3952 HOMEPC\Raymond                                          CBGrabConnect_x64
    141   2660    97      0.27 5368 HOMEPC\Raymond                                          CCBCertificate
    172   2592    83      0.05 6320 HOMEPC\Raymond                                          certd_nps3000_ICBC

 

如果不想用管理员身份的话,可以用(命令中的引号内容的空格不能省略):

tasklist /V /FO CSV | ConvertFrom-Csv  | Select-Object -Property "映像名称","会话#   ","会话名      ","用户名   " | Format-Table -AutoSize

结果如下:

映像名称                  会话#    会话名       用户名
--------                  -------- ------------ ---------
System Idle Process       0        Services     NT AUTHORITY\SYSTEM
System                    0        Services     暂缺
smss.exe                  0        Services     NT AUTHORITY\SYSTEM
csrss.exe                 0        Services     NT AUTHORITY\SYSTEM
wininit.exe               0        Services     NT AUTHORITY\SYSTEM
csrss.exe                 1        Console      NT AUTHORITY\SYSTEM
winlogon.exe              1        Console      NT AUTHORITY\SYSTEM
services.exe              0        Services     NT AUTHORITY\SYSTEM
lsass.exe                 0        Services     NT AUTHORITY\SYSTEM
svchost.exe               0        Services     NT AUTHORITY\SYSTEM

 

 

PowerShell中显示进程所属用户

标签:

原文地址:http://www.cnblogs.com/rgarnet/p/4453864.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!