2015-08-28 65 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 –