How to Use the UserAccountControl Flags to Manipulate User Account Properties
http://support.microsoft.com/?id=305144
Programatically set trusted for delegation using VBScript (Original sample http://www.microsoft.com/technet/community/scriptcenter/user/scrug52.mspx):
Function SetDelegation()
Const ADS_TRUSTED_FOR_DELEGATION = &h80000
Set objUser = GetObject ("LDAP://cn=myserver,ou=dept,dc=organization,dc=com")
intUAC = objUser.Get("userAccountControl")
If ADS_TRUSTED_FOR_DELEGATION AND intUAC Then
Wscript.echo "Already enabled"
Else
objUser.Put "userAccountControl", intUAC XOR ADS_TRUSTED_FOR_DELEGATION
objUser.SetInfo
WScript.Echo "Delegation enabled."
End If
End Function
Function SetAuthDelegation()
Const ADS_TRUSTED_TO_AUTH_FOR_DELEGATION = &h1000000
Set objUser = GetObject ("LDAP://cn=myserver,ou=dept,dc=organization,dc=com")
intUAC = objUser.Get("userAccountControl")
If ADS_TRUSTED_TO_AUTH_FOR_DELEGATION AND intUAC Thenn
Wscript.echo "Already enabled"
Else
objUser.Put "userAccountControl", intUAC XOR ADS_TRUSTED_TO_AUTH_FOR_DELEGATION
objUser.SetInfo
WScript.Echo "Trusted to Authentication for Delegation enabled."
End If
End Function
Function UnSetDelegation()
Const ADS_TRUSTED_FOR_DELEGATION = &h80000
Set objUser = GetObject ("LDAP://cn=myserver,ou=dept,dc=organization,dc=com")
intUAC = objUser.Get("userAccountControl")
If ADS_TRUSTED_FOR_DELEGATION AND intUAC Then
objUser.Put "userAccountControl", intUAC XOR ADS_TRUSTED_FOR_DELEGATION
objUser.SetInfo
Wscript.echo "Delegation disabled"
Else
WScript.Echo "Delegation already disabled."
End If
End Function
Function UnSetAuthDelegation()
Const ADS_TRUSTED_TO_AUTH_FOR_DELEGATION = &h1000000
Set objUser = GetObject ("LDAP://cn=myserver,ou=dept,dc=organization,dc=com")
intUAC = objUser.Get("userAccountControl")
If ADS_TRUSTED_TO_AUTH_FOR_DELEGATION AND intUAC Then
objUser.Put "userAccountControl", intUAC XOR ADS_TRUSTED_TO_AUTH_FOR_DELEGATION
objUser.SetInfo
Wscript.echo "Trusted to Authentication for Delegation disabled"
Else
WScript.Echo "Trusted to Authentication for Delegation already disabled."
End If
End Function