Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Function to convert UserAccountControl number to details text

By Shane Clarke,

This function can be used to display the details, in readable format, for UserAccountControl key.  It is useful when you need to display the status for user data imported from Active Directory based on the UserAccountControl number.

General outline on implementation:

  1. Create a table (AD_UserAccountControl)  to hold data of AD keys an details for UserAccountControl key
  2. Populate data as documented on http://support.microsoft.com/kb/305144
  3. Create function based on these AD Keys and rules

How to use function:

SELECT [dbo].[fn_AD_UserAccountControlDetails] (514) as TestControlDetails

Returns:  NORMAL_ACCOUNT, ACCOUNTDISABLE

-- The function can be be used combined with any table that contains UserAccountControl data

SELECT [Flag] ,[Details],[dbo].[fn_AD_UserAccountControlDetails] (flag) as UserStatus

FROM [dbo].[AD_UserAccountControl]

Total article views: 1122 | Views in the last 30 days: 3
 
Related Articles
FORUM

Function to convert UserAccountControl number to details text

Comments posted to this topic are about the item [B]Function to convert UserAccountControl number to...

FORUM

Rownumber function for the detail of every group

Rownumber function for the detail of every group

FORUM

"function"

"function"

BLOG

Complete DAX Function Reference

The DAX function documentation in MSDN can be found on separate pages,  organized by function catego...

FORUM

Transaction details

Transaction details

Tags
active directory    
ad    
adsi    
function    
useraccountcontrol    
 
Contribute