from my system i need to open a calculator in remote machine. and i'm using Vb.net and WMI. i need to pop up the calculator in remote machine, while i run one program in my system. while running in rmotre machine's taskmanager the calculator is displaying, but its not popuping.
i tried this code for pop up using Win32_ProcessSt artup like this...
[code=vbnet]
Module Module1
Sub Main()
Dim retValue As String
retValue = RunCommand("cal c.exe", "MachineNam e", "MachineName\Us erID", "Password")
Console.WriteLi ne(retValue)
End Sub
Function RunCommand(ByVa l strCommand As String, ByVal strMachineName As String, _
ByVal strUserName As String, ByVal strPassword As String) As String
Dim options As New System.Manageme nt.ConnectionOp tions
options.Usernam e = strUserName
options.Passwor d = strPassword
options.Imperso nation = Management.Impe rsonationLevel. Impersonate
options.Authent ication = Management.Auth enticationLevel .PacketPrivacy
Dim path As New System.Manageme nt.ManagementPa th("\\" & strMachineName & "\root\cimv2:Wi n32_Process")
Dim scope As New System.Manageme nt.ManagementSc ope(path, options)
Dim procStart As ManagementClass = New ManagementClass ("Win32_Process Startup")
Dim ps As ManagementObjec t = procStart.Creat eInstance
ps("ShowWindow" ) = 1
scope.Connect()
Dim opt As New System.Manageme nt.ObjectGetOpt ions
Dim classInstance As New System.Manageme nt.ManagementCl ass(scope, path, opt)
Dim inParams As System.Manageme nt.ManagementBa seObject = classInstance.G etMethodParamet ers("Create")
inParams("Comma ndLine") = strCommand
inParams("Proce ssStartupInform ation") = ps
' Execute the method and obtain the return values.
Dim outParams As System.Manageme nt.ManagementBa seObject = classInstance.I nvokeMethod("Cr eate", inParams, Nothing)
End Function
End Module
[/code]
is this the way we need to add Win32_ProcessSt artup inside my program.
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....
i tried this code for pop up using Win32_ProcessSt artup like this...
[code=vbnet]
Module Module1
Sub Main()
Dim retValue As String
retValue = RunCommand("cal c.exe", "MachineNam e", "MachineName\Us erID", "Password")
Console.WriteLi ne(retValue)
End Sub
Function RunCommand(ByVa l strCommand As String, ByVal strMachineName As String, _
ByVal strUserName As String, ByVal strPassword As String) As String
Dim options As New System.Manageme nt.ConnectionOp tions
options.Usernam e = strUserName
options.Passwor d = strPassword
options.Imperso nation = Management.Impe rsonationLevel. Impersonate
options.Authent ication = Management.Auth enticationLevel .PacketPrivacy
Dim path As New System.Manageme nt.ManagementPa th("\\" & strMachineName & "\root\cimv2:Wi n32_Process")
Dim scope As New System.Manageme nt.ManagementSc ope(path, options)
Dim procStart As ManagementClass = New ManagementClass ("Win32_Process Startup")
Dim ps As ManagementObjec t = procStart.Creat eInstance
ps("ShowWindow" ) = 1
scope.Connect()
Dim opt As New System.Manageme nt.ObjectGetOpt ions
Dim classInstance As New System.Manageme nt.ManagementCl ass(scope, path, opt)
Dim inParams As System.Manageme nt.ManagementBa seObject = classInstance.G etMethodParamet ers("Create")
inParams("Comma ndLine") = strCommand
inParams("Proce ssStartupInform ation") = ps
' Execute the method and obtain the return values.
Dim outParams As System.Manageme nt.ManagementBa seObject = classInstance.I nvokeMethod("Cr eate", inParams, Nothing)
End Function
End Module
[/code]
is this the way we need to add Win32_ProcessSt artup inside my program.
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....
Comment