回复 1# cj-reggie
如果杀别的机器进程最好用WMI了,API很不好使,还要写好远程让其执行程序得到回执做动作,根据楼上提示判断进程名为smss.exe和进程的可执行文件的路径不是C:\windows\system32\smss.exe的的查杀进程$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$strComputer = "."
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Process", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
For $objItem In $colItems
If $objItem.Description = "smss.exe" And $objItem.ExecutablePath <> "C:\windows\system32\smss.exe" Then
$objItem.Terminate
EndIf
Next
|