Echo Dim ReadComputerName >>port. vbs
Echo Set ReadComputerName=WScript.CreateObject("WScript.Shell") >>port. vbs
Echo Dim TSName,TSRegPath >>port. vbs
Echo TSRegPath="HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber" >>port. vbs
Echo TSName=ReadComputerName.RegRead(TSRegPath) >>port. vbs
Echo WScript.Echo("TermService port is:"^&TSName) >>port. vbs
Cscript port. vbs