I am making a script for easily changing the terminal services port on a windows 2003/2000 server or on a windows XP workstation. The problem is that I don't know how to take the users input and convert this into hexidecimal in the dword PortNumber entry. I have bolded the area where I would need to take the users decimal input and convert this into hexidecimal to place in this dword. I would greatly appreciate any help someone could provide.
thanks
thanks
Code:
'Script used to change the Default Terminal Services Port
'On Error Resume Next
'open the file system object
Set oFSO = CreateObject("Scripting.FileSystemObject")
set WSHShell = wscript.createObject("wscript.shell")
Dim WshNet 'WshNetwork object
Dim TSPortChange 'Variable to hold the new TS port
Dim Continue
Dim Exiting
'Create reference to Windows Scripting Host Network Object
Set WshNet = wscript.CreateObject("Wscript.Network")
'Providing an Input box to Enter TS Port
TSPortChange = InputBox("What Port would you like your Terminal Server or Remote Desktop Machine on? (i.e. 4000)","TS Port Changer")
Continue = MsgBox ("Is port "& TSPortChange &" correct?", 4, "TS Port Changer")
If (Continue = 7) Then
Exiting = MsgBox ("Nothing has been done. Exiting...", 64, "TS Port Changer")
Else
Call WSHShell.Run("cmd.exe /c copy port.reg portfinal.reg /Y")
Call WSHShell.Run("cmd.exe /c echo ""[b]PortNumber"=dword:00000fa1[/b]"" >> portfinal.reg")
Call WSHShell.Run("cmd.exe /c regedit /s portfinal.reg")
MsgBox ("Port chanaged to "& TSPortChange &", 64, "TS Port Changer")
End If