2015-08-28 58 views

回答

0

你可以使用WMI类Win32_Process的

stop-process (gwmi win32_process | ?{$_.getOwner().user -eq "username" -and $_.name -match "iexplore"} | select -expand processid) -WhatIf #remove -whatif to effectively stop the process

+0

感谢您的答复。当我运行这个,我得到错误。 例外调用“GetOwner”:“未找到” 在线:1 char:38 + stop-process(gwmi win32_process |?{$ _。getOwner()。user -eq“gssmboop” - and $ _。n ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~ CategoryInfo:未指定:(:) [],MethodInvocationException + FullyQualifiedErrorId:WMIMethodException –