Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame
Remote Desktop Protocol
RDP (Remote Desktop Protocol) is a protocol developed by Microsoft that provides a user with a graphical interface to connect to another computer over a network connection. Windows Remote Desktop Services is a server-based presentation virtualization component that allows a user to access applications and data hosted on a remote computer over a network.
Desktop virtualization is a software technology that can separate the desktop environment and its associated applications from the physical client that is used to access it. Desktop virtualization can be used together with application virtualization and user virtualization to provide a complete desktop environment management system. In Desktop virtualization, all the components of the desktop are virtualized, which allows for a flexible and more secure desktop delivery model.
User virtualization separates all of the software aspects that define a user's personality from the operating system.
Today, you will create an application in Visual Basic.NET capable of making Remote Desktop Connections. Start Visual Basic and create a new Windows Forms project. When the project has finished loading, add three textboxes and two buttons onto it. The textboxes will be used to enter the Server name, User name, and Password. The two buttons will be used to Connect and Disconnect.
Make your form much bigger than the default size.
Use the following steps to add a reference to Microsoft Terminal Services Active Client:
- Click Project.
- Click Add Reference.
- On the COM tab, scroll down until you find Microsoft Terminal Services Active Client and tick it (see Figure 1).
Figure 1: Add a Reference
Use the following steps to add the Microsoft Terminal Services Client Control to your Toolbox:
- Right-click your Toolbox.
- Click Choose Items.
- Select the COM Components tab.
- Scroll down until you find Microsoft Terminal Services Client and tick it, as shown in Figure 2.
- Click OK.
Figure 2: Toolbox Items
Your Toolbox should show two new controls inside (see Figure 3).
Figure 3: New tools
Add the Terminal Services Client Control to your form. Your form's final design should resemble Figure 4.
Figure 4: Design
The design is set up nicely now. You have to add the reference to get the Toolbox items so that we can add them onto the form.
Import the Microsoft Terminal Services Client Library namespace:
Add the following code behind the 'Connect' button:
Private Sub btnConnect_Click(sender As Object, e As EventArgs) _ Handles btnConnect.Click Try rdpView.Server = txtServer.Text rdpView.UserName = txtUserName.Text Dim isSecured As IMsTscNonScriptable = _ DirectCast(rdpView.GetOcx(), IMsTscNonScriptable) isSecured.ClearTextPassword = txtPassword.Text rdpView.Connect() Catch ex As Exception MessageBox.Show("Cannot Connect", "Cannot Connect to: " _ + txtServer.Text + " Reason: " + ex.Message, _ MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub
The Username and Server details get supplied. The IMsTscNonScriptable interface configures automatic password logon access to Remote Desktop Session Host servers. if all details are correct, rdpView will connect to the remote server and establish a connection. If anything fails, the Try and Catch block will produce the necessary exception output.
Add the next code behind the 'Disconnect' button:
Private Sub btnDisconnect_Click(sender As Object, e - As EventArgs) Handles btnDisconnect.Click Try If rdpView.Connected.ToString() = "1" Then rdpView.Disconnect() End If Catch ex As Exception MessageBox.Show("Cannot Disconnect", _ "Cannot Disconnect from: " _ + txtServer.Text + " Reason: " + ex.Message, _ MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub
If connected, disconnect.
Please feel free to download RemoteDesktop_Ex, the program to accompany this article. It's found below.
Being able to create an application that can connect remotely to other users can provide you with another option to do proper application and desktop support.