473,387 Members | 1,664 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

HOWTO: Kill process on remote workstation using system.management?

I found the following code:
Public Function WMIKill()

Dim colProcesses As Management.ManagementObjectSearcher

Dim colObserver As New Management.ManagementOperationObserver

Dim refProcess As Management.ManagementObject

colProcesses = New Management.ManagementObjectSearcher("SELECT * " & _
"FROM
Win32_Process " & _
"WHERE Handle
= '" & _processName & "'")
colProcesses.Scope = New Management.ManagementScope("\\" & _ws &
"\root\cimv2")
If colProcesses.Get.Count = 0 Then
Else
For Each refProcess In colProcesses.Get
Try
refProcess.InvokeMethod(colObserver, "Terminate", Nothing)
Catch ex As Exception
_errorMsg = ex.Message
End Try
Next
End If
End Function

However, the process (in this case, notepad) doesn't close.

Any help would be greatly appreciated.

TIA,
NB
Jul 21 '05 #1
0 1358

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Fred | last post by:
There is a setting in INIT.ORA that has the unintended side-effect of making sure the ALTER SYSTEM KILL SESSION command has immediate affect. Without this setting, I've seen some instances where...
5
by: Thomas Chan | last post by:
I have an application that need to launch acrobat reader. But before I open acrobat reader, I want to check there is any existing acrobat reader opening and kill them first. What can I do? Can...
6
by: Ganesh | last post by:
Is there a utility by microsoft (or anyone) to force garbage collection in a process without have access to the process code. regards Ganesh
4
by: Prince Kumar | last post by:
I joined a company recently and they have a java program which hangs (does nothing) after a while. This is no way consistent. It could succeed quite a few times and can fail a few other times....
0
by: steven chong | last post by:
hi everyone, I need to do a query into some remote registry, workstation PCs as well as domain PCs. Previously, i was using the native WMI COM objects like this: objLocator =...
1
by: Manfred Braun | last post by:
Hi All, I am writing a tool, which should monitor some exe-processes, which are not very solid. Th main function is to re-start them, if they hung, but this is complicated. I can detect things...
1
by: james | last post by:
I am attempting to write a VB.net program to alter remote registeries. I am familiar with VBScript and so I was using WMI to connect to remote machines. How would I do this in VB.Net? I got this...
0
by: nb.home | last post by:
I found the following code: Public Function WMIKill() Dim colProcesses As Management.ManagementObjectSearcher Dim colObserver As New Management.ManagementOperationObserver Dim refProcess As...
1
by: remya1000 | last post by:
i'm tring to start a calculator in a remote machine from my system. and the codes i tried is this. Module Module1 Sub Main() Dim retValue As String retValue =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.