![]() |
|
|
+ Search |
![]()
|
Aug 12th, 2005 10:28
Chris Hafner, Yap Sy Yuan, Steven W, Jean Chen, Robin Paardekam, Mark Grimes, ashutosh sharma, Pravi, maysa bosila,
Hello Together
I would suggest you do make a RemoteCall through WMI on the server-
side, invoking a program on the according client.
Some sample code (VB.NET):
---- code begin ----
Private Function _RemoteCall(ByVal ComputerName As String, ByVal
Application As String, ByVal WorkingDirectory As String, ByVal Username
As String, ByVal Password As String, ByRef ProcessID As Integer) As
Int32
Dim Service As SWbemServices
'Der Service eines remote Comuters wird eingeholt
_RemoteCall = Connect_Server(ComputerName, Username, Password,
Service)
If _RemoteCall <> 0 Then
Return _RemoteCall
End If
Dim Proc As Object 'As SWbemObject
Try
'Einholen aller Processes auf dem remote Computer
Proc = Service.Get("Win32_Process")
'TODO: Enablen!!
Catch ex As Exception
_RemoteCall = 102
Return _RemoteCall
End Try
Dim oInPar, oOutPar As SWbemObject
'Try this
Dim ID As UInt32
' Set the Create Method
Dim oMethodSet As SWbemMethodSet
oMethodSet = Proc.Methods_
oMethodSet.Item("Create")
'Dim oMethod As SWbemMethod = Proc.Methods_.Item("Create")
Dim oMethod As Object = Proc.Methods_("Create")
'Create a new Instance
oInPar = oMethod.InParameters.SpawnInstance_()
'Set the CommandLine
oInPar.CommandLine = Application
If WorkingDirectory <> "" Then
oInPar.CurrentDirectory = WorkingDirectory
End If
'Create the Process
oOutPar = Proc.ExecMethod_("Create", oInPar)
'return the Values returned
'This Returnvalue only represents the Errors returned during
the Creation of the Process
_RemoteCall = oOutPar.ReturnValue
'The by Ref Variable is set here. Returns the ID of the Created
Process
Try
ProcessID = oOutPar.ProcessId
Catch ex As InvalidCastException
ProcessID = -1
End Try
Return _RemoteCall
End Function
---- code end ----
Hope that helps.
Best regards
Chris
© 1999-2004 Synop Pty Ltd