Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- strComputer = "."
- Set objWMIService = GetObject("winmgmts:" _
- & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
- i = x
- Do While i = x
- Set colProcesses = objWMIService.ExecQuery _
- ("Select * from Win32_Process Where Name = 'wordpad.exe'")
- If colProcesses.Count = 0 Then
- 'It does not exist do nothing
- Else
- For Each objProcess in colProcesses
- objProcess.Terminate()
- Set colProcesses = objWMIService.ExecQuery _
- ("SELECT * FROM Win32_Process WHERE Name = 'notepad.exe'")
- For Each objProcess2 in colProcesses
- objProcess2.Terminate()
- Next
- Dim objShell
- Set objShell = WScript.CreateObject( "WScript.Shell" )
- objShell.Run("""C:\Windows\System32\notepad.exe""")
- Set objShell = Nothing
- Next
- End If
- Loop
Add Comment
Please, Sign In to add comment