Configure encryption level for all TS sessions (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 sets the encryption level for all TS sessions
' ------ SCRIPT CONFIGURATION ------
Const LOW_LEVEL       = 1
Const CLIENT_COMPAT   = 2
Const HIGH_ENCRYPTION = 3
Const FIPS_COMPLIANT  = 4

strComputer = "."
intLevel = HIGH_ENCRYPTION
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colItems = objWMI.ExecQuery("Select * from Win32_TSGeneralSetting")
for each objItem in colItems
    intRC = objItem.SetEncryptionLevel(intLevel)
    if intRC then
       WScript.Echo "Error setting encryption level for " & _
                    objItem.TerminalName & ":" & intRC
    else
       WScript.Echo "Set encryption level for " & objItem.TerminalName & _
       " to " & intLevel
    end if
next

This code has been viewed 815 times.

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