Click here to Skip to main content
15,913,669 members
Articles / Programming Languages / C#
Tip/Trick

Remote Assistance in Windows 7 Using C#.NET

Rate me:
Please Sign up or sign in to vote.
4.00/5 (2 votes)
23 Jan 2015CPOL 14.4K   7  
Remote Assistance using the MSRA EXE and its arguments

Introduction

Here, I have designed a class and a form, and it gives you the following functionalities:

  1. Offer Remote Assistance to a Machine
  2. Ask for Remote Help (Invite someone to help you)

Design a form with the following controls:

  1. Textbox for taking the IP or computer name to Connect
  2. Button 1. To connect to the Remote Machine for offering Remote Assistance
  3. Button 2. To ask or invite someone to help

Image 1

Code behind in the Form is as given below:

C#
private void btnConnect_Click(object sender, EventArgs e)
        {
            RemoteConnect remoteConnect = new RemoteConnect();
            Boolean status;
			status = remoteConnect.StartRemoteAssistance
					(txtComputerName.Text.ToString(), true, false);
            System.Windows.Forms.MessageBox.Show(status.ToString());
        }

			private void BtnInvite_Click(object sender, EventArgs e)
        {
            RemoteConnect remoteConnect = new RemoteConnect();
            Boolean status;
            status = remoteConnect.StartRemoteAssistance
			(txtComputerName.Text.ToString(), false, true);
        }

We have two buttons here and they are sending the Boolean variable to the class function for differentiating between Offer Help and Ask for Help.

Code under the Class File: RemoteConnect is as follows:

C#
namespace RemoteAssist
{
    class RemoteConnect
    {
	public Boolean StartRemoteAssistance
		(String strMachinename, Boolean offerHelp, Boolean askForHelp)
        {            
	System.Diagnostics.Process process = new System.Diagnostics.Process();

	System.Diagnostics.ProcessStartInfo startInfo = 
				new System.Diagnostics.ProcessStartInfo();
	startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;            
            startInfo.FileName = "msra.exe";

            // Offer Remote Assistance 
            if (offerHelp == true)
            {
                startInfo.Arguments = "/offerRA " + strMachinename;
            }

            //ASK for Remote Assistance
            if (askForHelp == true)
            {
                startInfo.Arguments = "novice";
            }

            try
            {
                process.StartInfo = startInfo;
                process.Start();
                return true;
            }

            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show
                ("Error Occurred while processing Remote Assistance" + ex.Message);
                return false;
            }       
        }
    }
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Allianz
India India
A simple human being loves my small world. I just enjoy learning new skills and taking on new challenges. I have 9+ years experience in IT.

Got my skill sets in ASP.Net, MVC, Angular JS, Oracle , SQL Server and VB6 and I am keeping an eye on the future technologies that pops around the IT world!

Comments and Discussions

 
-- There are no messages in this forum --