1
Reply

Please Look at my code - Help

riverbr

riverbr

Apr 26 2004 3:08 PM
1.6k
I need your assistance (I'm pretty new and I'm trying to convert from scripting to VB.Net).. I'm having problems understating the help from Microsoft on how to run/use a method using the System.Management name space. Here is what I'm trying to do. example. Below is a function. As you can see I trying to pull the list of process from a computer and I would like to terminate process a particular process -- But I'm stuck. I do not know the syntax. Please give me an example. Function FTerminate(ByVal ComputerName As String, ByVal StrProcessName As String) As String Dim strResult As String Dim objectQuery As New System.Management.ObjectQuery("Select * From Win32_Process") Dim scope As New System.Management.ManagementScope("\\" & ComputerName & "\root\cimv2") scope.Connect() Dim patch As New ManagementObjectSearcher(scope, objectQuery) Dim strProcess As ManagementObject For Each strProcess In patch.Get If strProcess("Caption") = StrProcessName Then strProcess _ ______> terminate Method here please assist. End If Next Return strResult End Function End Module Thank you Regards, Braulio

Answers (1)