Jump to content
Sign in to follow this  
euverve

How to processclose using wmi?

Recommended Posts

euverve

I would like to ask how could i close a certain process using WMI?

Please help, thanks

Share this post


Link to post
Share on other sites
SmOke_N

I would like to ask how could i close a certain process using WMI?

Please help, thanks

Curious, why must it be with WMI?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
ptrex

@Thatskie

Maybe this can get you going.

Dim $objWMIService, $objProcess, $colProcess
Dim $strComputer, $strProcessKill, $strInput 
$strProcessKill = "'calc.exe'" 

; Input Box to get name of machine to run the process
Do 
    $strComputer = (InputBox(" ComputerName to Run Script","Computer Name"))
    If $strComputer <> "" Then
    $strInput = 1
    EndIf
Until $strInput = 1


 $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") 

 $colProcess = $objWMIService.ExecQuery ("Select * from Win32_Process Where Name = " & $strProcessKill )
 
For $objProcess in $colProcess
    $objProcess.Terminate()
Next 
ConsoleWrite ("Just killed process " & $strProcessKill & " on " & $strComputer & @CRLF)

regards

ptrex

Share this post


Link to post
Share on other sites
euverve

Thanks alot for these codes.

@SmOke_N

Some computer viruses/worms uses same names like those windows process, instead of using process close i will use this wmi to kill the worm running processes.

Thanks all.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×