You can use VBScript to connect to a remote computer within either a business network or other secure, internal network. Your ability to connect to a remote computer using a VBScript file will require the computer to be turned on and to have an IP address or domain name to make the connection within a network. Once you've established those prerequisites, you will write the script to test your connection.
Click the "Start" button, and then click "Run."
Type "cmd /k" in the Open text box and click the "OK" button.
Type the following at the command prompt, where "computer_name" is either the IP address or the domain name of the computer: "ping computer_name".
Verify that the system returns with four reply messages.
Open your text editor.
Type the following code:
machine = InputBox("Enter Name of the Remote Computer:","Prompt!")
cimv2_string = "WINMGMTS:" & "\" & machine & "\root\cimv2"
query = "select * from Win32_TerminalServiceSetting"
value_to_set = 1 ' 0=off, 1=on
set cimv2 = GetObject( cimv2_string )
set items = cimv2.ExecQuery( query )
for each item in items
item.SetAllowTSConnections( value_to_set )
wscript.Echo "Terminal Services has been enabled."
Save the file with a .vbs extension to computer's hard drive.
Double-click the .vbs file, and enter the computer name in the text box provided. Verify that it returns with the message "Terminal Services has been enabled."
Attempt to connect to the remote computer using Remote Desktop Protocol application in Windows. If you are able to log in, then the remote connection VBScript has executed correctly.
Be certain to ping a remote computer and ensure that it is on before attempting to connect.
Firewalls and security software can prevent you from connecting to a remote computer using VBScript.