Set trusted for delegation flag (VBScript)

This code can be found in Chapter 4 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 trusted for delegation flag
' on a computer object
' ------ SCRIPT CONFIGURATION ------
strComputerDN = "<ComputerDN>" 
' e.g. cn=rallen-wxp,cn=computers,dc=rallencorp,dc=com
' ------ END CONFIGURATION ---------

Const TRUSTED_FOR_DELEGATION = &H80000

set objComp = GetObject("LDAP://" & strComputerDN)
intUAC = objComp.Get("userAccountControl")

If intUAC AND TRUSTED_FOR_DELEGATION Then
   WScript.Echo "Trusted for delegation flag already set"
else
   objComp.Put "userAccountControl", intUAC OR TRUSTED_FOR_DELEGATION
   objComp.SetInfo
   WScript.Echo "Set trusted for delegation flag"
end If

This code has been viewed 1250 times.

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