Torna al Thread

Private Function RunCommand(ByVal strCommand As String) As String Dim strMachineName As String = "." Dim path As New System.Management.ManagementPath("\\" & strMachineName & "\root\cimv2:Win32_Process") Dim scope As New System.Management.ManagementScope(path) scope.Connect() Dim opt As New System.Management.ObjectGetOptions() Dim classInstance As New System.Management.ManagementClass(scope, path, opt) Dim inParams As System.Management.ManagementBaseObject = classInstance.GetMethodParameters("Create") inParams("CommandLine") = strCommand ' Execute the method and obtain the return values. Dim outParams As System.Management.ManagementBaseObject = classInstance.InvokeMethod("Create", inParams, Nothing) Return outParams("returnValue") End Function
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5