首页 > 解决方案 > 试图找出一个脚本来使用powershell在本地网络上停止特定用户下的进程

问题描述

我需要一个脚本来终止特定用户在本地网络上运行的进程。

我用了

(get-wmiobject Win32_process -ComputerName thepcname | 
   ? {$_.ProcessName -match "notepad" }).Terminate()

但也需要用户指定。请问我该怎么做?

标签: powershell

解决方案


您可以使用:

Get-Process -ComputerName thepcname -IncludeUserName

然后过滤$_.UserName

请注意,这将需要管理员权限。


推荐阅读