Hello folks,
I'm working on a simple AutoIT script that uses VB script/WMIC to kill a remote process. I have the GUI designed, but need a little help getting everything working together.
On the Main GUI, I have a listbox that I'd like to be able to store and retreive data to using a CSV file. I have an Add and Remove button. The Add button pulls up form 2(see code below) which allows the entry of a Computer name and its IP.
Of course also on the main gui is the location to type in the name of the process, with a button that says End process which I would like to execute the script below when pressed. Anybody out there willing to guide me along in finishing this out?
Also, I should add, on the main gui... I don't want to show the IP address of the PC in the listbox, but when the script executes, I want the IP address to be used instead of the netbios name, if that makes sense.
I'm working on a simple AutoIT script that uses VB script/WMIC to kill a remote process. I have the GUI designed, but need a little help getting everything working together.
On the Main GUI, I have a listbox that I'd like to be able to store and retreive data to using a CSV file. I have an Add and Remove button. The Add button pulls up form 2(see code below) which allows the entry of a Computer name and its IP.
Of course also on the main gui is the location to type in the name of the process, with a button that says End process which I would like to execute the script below when pressed. Anybody out there willing to guide me along in finishing this out?
Also, I should add, on the main gui... I don't want to show the IP address of the PC in the listbox, but when the script executes, I want the IP address to be used instead of the netbios name, if that makes sense.
[ autoit ]
;This script will kill a specified process. ;Chey Harden 8.11.06 Dim $objWMIService, $objProcess, $colProcess Dim $strComputer, $strProcessKill, $strInput $strProcessKill = inputbox("Enter Process Name Here","Process Name") $strProcessKill = "'" & $strProcessKill & "'" ; 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 ;VA WScript.Quit
[ autoit ]
;Form 1 #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Cravin\Desktop\Koda\Forms\Form1.kxf $mainForm = GUICreate("Process Terminator", 491, 301, 192, 124) $compList = GUICtrlCreateList("", 24, 64, 209, 188) $Label1 = GUICtrlCreateLabel("Select the PC to terminate the process on:", 32, 40, 203, 17) $Process = GUICtrlCreateInput("", 256, 64, 209, 21) $Label2 = GUICtrlCreateLabel("Enter name of process to terminate:", 256, 40, 171, 17) $endProc = GUICtrlCreateButton("End Process", 256, 240, 211, 49) $add = GUICtrlCreateButton("Add", 24, 264, 99, 25) $rem = GUICtrlCreateButton("Remove", 136, 264, 99, 25) $Label3 = GUICtrlCreateLabel("Process Terminator", 152, 8, 186, 28) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
[ autoit ]
;Form 2 #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Cravin\Desktop\Koda\Forms\Form2.kxf $Form2 = GUICreate("Add Computer", 227, 121, 203, 347) $Label1 = GUICtrlCreateLabel("Computer Name", 8, 8, 80, 17) $CompNameAdd = GUICtrlCreateInput("", 8, 32, 209, 21) $OK = GUICtrlCreateButton("OK", 144, 88, 75, 25) $CompAddIP = GUICtrlCreateInput("", 8, 88, 121, 21) $IP = GUICtrlCreateLabel("IP Address", 8, 64, 55, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd