WMI commandline SSIS Script Component -
12-22-2009
, 01:01 PM
Question: The WMI return value only returns if the command line is submitted.
How can you tell if it finished and what value was returned?
This is my SSIS Script Component
'WMI section
'
Dim manScope As ManagementScope
Dim ConnOptions As ConnectionOptions
Dim ObjectGetOptions As ObjectGetOptions
ConnOptions = New ConnectionOptions
ConnOptions.Impersonation = ImpersonationLevel.Impersonate
ConnOptions.EnablePrivileges = True
Dim path As New System.Management.ManagementPath("mycomputer" &
"\root\cimv2:Win32_Process")
Dim scope As New System.Management.ManagementScope(path, ConnOptions)
scope.Connect()
Dim opt As New System.Management.ObjectGetOptions()
Dim processClass As New System.Management.ManagementClass(scope,
path, opt)
processClass = New ManagementClass(scope, path, opt)
Dim processStartupClass As ManagementClass
Dim cmd As String
Dim inParams As ManagementBaseObject =
processClass.GetMethodParameters("Create")
inParams("CommandLine") = mycommand
inParams("ProcessStartupInformation") = processStartupClass
Dim outParams As ManagementBaseObject =
processClass.InvokeMethod("Create", inParams, Nothing)
MsgBox(outParams("returnValue").ToString, MsgBoxStyle.DefaultButton1)
MsgBox(outParams("processId").ToString, MsgBoxStyle.DefaultButton1) |