i tried this code for pop up using Win32_ProcessStartup like this...
Expand|Select|Wrap|Line Numbers
- Module Module1
- Sub Main()
- Dim retValue As String
- retValue = RunCommand("calc.exe", "MachineName", "MachineName\UserID", "Password")
- Console.WriteLine(retValue)
- End Sub
- Function RunCommand(ByVal strCommand As String, ByVal strMachineName As String, _
- ByVal strUserName As String, ByVal strPassword As String) As String
- Dim options As New System.Management.ConnectionOptions
- options.Username = strUserName
- options.Password = strPassword
- options.Impersonation = Management.ImpersonationLevel.Impersonate
- options.Authentication = Management.AuthenticationLevel.PacketPrivacy
- Dim path As New System.Management.ManagementPath("\\" & strMachineName & "\root\cimv2:Win32_Process")
- Dim scope As New System.Management.ManagementScope(path, options)
- Dim procStart As ManagementClass = New ManagementClass("Win32_ProcessStartup")
- Dim ps As ManagementObject = procStart.CreateInstance
- ps("ShowWindow") = 1
- 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
- inParams("ProcessStartupInformation") = ps
- ' Execute the method and obtain the return values.
- Dim outParams As System.Management.ManagementBaseObject = classInstance.InvokeMethod("Create", inParams, Nothing)
- End Function
- End Module
sorry for disturbing you again. actually i dont have much idea about WMI. i'm new to this. that's why.
if any thing wrong in this codes, please let me know. while running its not creating any errors, but not displaying the calculator in windows. that's why...
if you have any idea please let me know....
thanks in advance and thanks for your help....