Configure remote control (VBScript)

This code can be found in Chapter 17 of Windows Server 2003 Security Cookbook

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' This code configures the RemoteControl setting of a Terminal session.
' ------ SCRIPT CONFIGURATION ------
Const DISABLE                   = 0
Const ENABLE_INPUT_NOTIFY       = 1
Const ENABLE_INPUT_NO_NOTIFY    = 2
Const ENABLE_NO_INPUT_NOTIFY    = 3
Const ENABLE_NO_INPUT_NO_NOTIFY = 4

strComputer = "."
intSetting = ENABLE_NO_INPUT_NO_NOTIFY
strTerminal = "RDP-Tcp"
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colItems = objWMI.ExecQuery( _
                      "Select * from Win32_TSRemoteControlSetting Where " & _
                      " TerminalName = '" & strTerminal & "'")
for each objItem in colItems  
   intRC = objItem.RemoteControl(intSetting)
   if intRC then
      WScript.Echo "Error setting RemoteControl value"
   else
      WScript.Echo "Set RemoteControl value: " & intSetting
   end if
next

This code has been viewed 1124 times.

New from the creators of TechTasks.com: StatSheet.com