Powertip Of The Day-Get process owners

Source: Internet
Author: User

Original article address:Http://app.en25.com/e/es.aspx? S = 1403 & E = 5287 & elq = ffdaeb1db50d44cd98829640038cf0d4

Original article:

If you need to filter running processes by owner, for example to terminate the ones owned by some user, you shoshould Use wmi and the getowner () method. this code will retrieve all processes from a local or remote system and add an owner property, which you can then use to select or filter processes:

Get-wmiobject Win32_process | Foreach-Object { $ Ownerraw = $ _. Getowner () ; $ Owner = '{0} \ {1 }' -F $ Ownerraw . Domain , $ Ownerraw . User ; $ _ | Add-member Noteproperty owner $ Owner -Passthru } | Select-Object Name , Owner

Note that you can get Owner information for other users only when you have admin privileges.

 

 

Translation:

If you want to filter running processes based on the process owner, for example, you can useWMIOfGetowner ()Method. The followingCodeIt will retrieve information about all local or remote processes and add themOwnerAttribute, you can select and filter the process based on this:

Get-wmiobject Win32_process | Foreach-Object { $ Ownerraw = $ _. Getowner () ; $ Owner = '{0} \ {1 }' -F $ Ownerraw . Domain , $ Ownerraw . User ; $ _ | Add-member Noteproperty owner $ Owner -Passthru } | Select-Object Name , Owner

Note that when you have the Administrator permission, you can also obtain other information about the process user. [Question]

 

 

Notes:

Suitable for killing processes based on the owner and troubleshooting virus processes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.