Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favourite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved 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: 560 | Views in the last 30 days: 6
 
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"

FORUM

Transaction details

Transaction details

Tags
active directory    
ad    
adsi    
function    
useraccountcontrol    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones