Remote on/Off Windows Script for target Telnet service Rtcs.vbs_vbs

Source: Internet
Author: User
RTCS v1.10
Remote Telnet Configure Script, by zzzevazzz
Welcome to visite
cscript c:\scriptpath\RTCS.vbe targetip username password ntlmauthor
It'll auto change state of target Telnet server.
Description: Windows script to remotely turn on/off the target Telnet service.
Features: ipc$ open or not dependent on the target.
Rationale: Direct access to the target Windows Management Specification service (WMI). This service is an important service for the system and is started by default.
Support platform: Win2kpro win2kserver winxp
How to use:
Use the script Host program cscript.exe with Windows from the command-line to invoke the script, for example:
C:\>cscript Rtcs.vbe < target ip> < username > < password > &LT;NTLM authentication mode > <telnet Service port >
Where NTLM values are desirable 0,1,2:
0: Do not use NTLM authentication;
1: Try NTLM authentication first. If it fails, then use the username and password;
2: Use NTLM authentication only.
The empty password is expressed in two double quotes "".
The script automatically checks the target Telnet service and starts it if it is not started, and shuts down instead.
Once the same command is executed two times, the service is open/closed once.
You must also enter a total of 5 parameters when you close the service so that you can restore the service settings to their default values (ntlm=2, port 23) as needed.
If the Telnet service is disabled, it is automatically changed to manual.
If you want to use locally, the IP address is or a dot (in.), and both the username and password are empty (represented by "").
This script is for free software, modify the publication please Ming original author. Thank you for your cooperation.
I provide limited technical support, there are questions please send me a short message to the forum. My id is zzzevazzz.

Last Updated: 2002-8-23
Update records:
1.10 changed the output display format.
1.09 solved the problem of the empty password.
1.08 code is encrypted and released as a beta release.
1.07 increase the ability to deal with services being "disabled".
1.06 solve the problem of running under the graphical interface.
1.05 make simple judgment to the parameter, prevent misoperation.
1.04 increase display usage and detailed process functionality.
1.03 increase the Shutdown service function.
1.02 increase the manual setting of ports and NTLM functionality.
1.00 complete the basic function, remote start Telnet service, and set Ntlm=1.
Copy Code code as follows:

On Error Resume Next
Set Outstreem=wscript.stdout
if (LCase right (wscript.fullname,11) = "Wscript.exe") Then
Set Objshell=wscript.createobject ("Wscript.Shell") ("cmd.exe/k cscript//nologo" &AMP;CHR (34))
End If
If Wscript.arguments.count<5 Then
Usage ()
WScript.Echo "Not enough parameters."
End If

Ipaddress=wscript.arguments (0)
Username=wscript.arguments (1)
Password=wscript.arguments (2)
Ntlm=wscript.arguments (3)
Port=wscript.arguments (4)
If not IsNumeric (NTLM) or ntlm<0 or ntlm>2 then
Usage ()
WScript.Echo "The value of ntml is wrong."
End If
If not IsNumeric (port) Then
Usage ()
WScript.Echo "The value of the port is wrong."
End If

Usage ()
Outstreem.write "conneting" &ipaddress& "..."
Set Objlocator=createobject ("WbemScripting.SWbemLocator")
Set Objswbemservices=objlocator.connectserver (IPAddress, "Root/default", Username,password)
ShowError (Err.Number)

Outstreem.write "Setting ntlm=" &ntlm& "..."
Set Objinstance=objswbemservices.get ("StdRegProv")
Set Objmethod=objinstance.methods_ ("SetDWORDValue")
Set Objinparam=objmethod.inparameters.spawninstance_ ()
Objinparam.ssubkeyname= "software\microsoft\telnetserver\1.0"
Objinparam.svaluename= "NTLM"
Set Objoutparam=objinstance.execmethod_ ("SetDWORDValue", Objinparam)
ShowError (Objoutparam.returnvalue)

Outstreem.write "Setting port=" &port& "..."
Objinparam.svaluename= "Telnetport"
Set Objoutparam=objinstance.execmethod_ ("SetDWORDValue", Objinparam)
ShowError (Objoutparam.returnvalue)

Outstreem.write "Querying state of Telnet Server ..."
Set Objswbemservices=objlocator.connectserver (IPAddress, "root\cimv2", Username,password)
Set Colinstances=objswbemservices.execquery ("SELECT * FROM Win32_Service where name= ' Tlntsvr '")
ShowError (Err.Number)
For each objinstance in colinstances
If objinstance.startmode= "Disabled" Then
Outstreem.write "Telnet server has been disabled. Now changeing the start mode to manual ....
Set Objmethod=objinstance.methods_ ("ChangeStartMode")
Set Objinparam=objmethod.inparameters.spawninstance_ ()
Objinparam.startmode= "Manual"
Set Objoutparam=objinstance.execmethod_ ("ChangeStartMode", Objinparam)
ShowError (Objoutparam.returnvalue)
End If
Outstreem.write "changeing State ..."
If Objinstance.started=true Then
Intstatus=objinstance.stopservice ()
ShowError (Intstatus)
WScript.Echo "Target Telnet Server has been STOP successfully."
Intstatus=objinstance.startservice ()
ShowError (Intstatus)
WScript.Echo "Target Telnet Server has been START successfully!"
WScript.Echo "Now, you can try:telnet" &ipaddress& "" &port& "to get a shell."
End If

function ShowError (errornumber)
If Errornumber<>0 Then
WScript.Echo "Error!"
WScript.Echo "Ok!"
End If
End Function

function usage ()
WScript.Echo String (79, "*")
WScript.Echo "RTCS v1.10"
WScript.Echo "Remote Telnet Configure Script, by Zzzevazzz"
WScript.Echo "Welcome to visite"
WScript.Echo "Usage:"
WScript.Echo "cscript" &wscript.scriptfullname& "targetip username password ntlmauthor telnetport"
WScript.Echo "It'll auto change state of target Telnet server."
WScript.Echo String (+, "*") &vbcrlf
End Function
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.