Solved

vb.net and WMI - remote process killing

Posted on 2014-10-31
1
136 Views
Last Modified: 2014-10-31
Attempting to kill a remote process using vb.net and wmi.  I can query the processes fine and is a specify a process ID to kill, it works fine, but when i try and set the process id as variable it fails.  Assuming it fails because im not calling the selecteditem properly:

Dim RC As String = TextBox1.Text
        Dim taskID As String = listview2.selecteditems (doesnt work), (when i replace with "4784", it works)

        Dim theScope As New ManagementScope("\\" & RC & "\root\cimv2")
        Dim objectQuery As New ObjectQuery(String.Concat("SELECT * FROM Win32_Process WHERE ProcessID='", taskID, "'"))
        For Each managementObject As ManagementObject In (New ManagementObjectSearcher(theScope, objectQuery)).[Get]()
            managementObject.InvokeMethod("Terminate", Nothing)
        Next
    End Sub

Open in new window

0
Comment
Question by:derek7467
1 Comment
 

Accepted Solution

by:
derek7467 earned 0 total points
Comment Utility
believe I figured it out, should have used google a bit more:

ListView1.FocusedItem.Text
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now