C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |



My Profile

Gifts

Active Members
TodayLast 7 Days more...







Running application from another system


Posted Date: 16 May 2008    Resource Type: Code Snippets    Category: VB.NET Syntax

Posted By: Abhishek Arya       Member Level: Diamond
Rating:     Points: 10



This function will call the application from the other system. It's same like right the application and then run as with diffrent login.

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

Dim path As New System.Management.ManagementPath("\\" & strMachineName & "\root\cimv2:Win32_Process")
Dim scope As New System.Management.ManagementScope(path, options)

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 "ReturnValue:" & outParams("returnValue") & " Process ID: {0}" & outParams("processId")

End Function



For more details, visit http://weblogs.asp.net/steveschofield/archive/2006/06/06/WMI---start-a-process-on-remote-machine-passing-credentials_2E00_.aspx




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Convert Bitmap to Another Image Format
Previous Resource: How to get IP Address in VB.net
Return to Discussion Resource Index
Post New Resource
Category: VB.NET Syntax


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use