Importing flags attribute (userAccountControl) to boolean values
I want to create a set of users whose account is disabled. In Active Directory an account is disabled if its userAccountControl value (type integer) contains the "ACCOUNTDISABLED" flag, whose value is 2. I created a boolean attribute in the MV, called Disabled. How could I define an inbound attribute flow for this? I tried with "BitAnd(userAccountControl,2)", but it doesn't work because the function's return type is integer; a custom expression "BitAnd(userAccountControl,2) = 2" doesn't work either. Thanks for any suggestion, Paolo
May 22nd, 2009 6:06pm

You could try the custom expression:IIF(Eq(BitAnd(userAccountControl,2), 2), true, false)I think that is the format but can't test at the moment.. Be careful as it is case sensitive.EricEric
Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2009 6:12pm

Hi Eric, Eq(BitAnd(userAccountControl,2),2) was enough, thanks! Eq was exactly what I was looking for, but I couldn't find it in the functions list; is there a reference somewhere of what can go into a custom expression? Thanks, Paolo
May 22nd, 2009 6:16pm

Brad Turner had one he was passsing out at TEC. I also compiled one for my own purposes with some samples uses...It doesn't appear too pretty here but I put the function, description, sample and sample results.This is not final, just what I've gleemed from testing what is provided in the GUI... hFunction Description Example Result BitAND The BitAnd function sets specified bits on a flag to 0 BitAnd(2,useraccountcontrol) 512 BitOR The BitOr function sets specified bits on a flag to 1 BitOr(2,useraccountcontrol) 514 ConvertSidToString Converts byte array containing security identifier to a string ConvertSidToString(objectSid) S-1-5-21-9999999-9999-999999 CRLF Generates a Carriage Return/Line Feed. This function will be used when the value users want to enter contains a new line "Text" + CRLF() + "Text" Text Text DateTimeFormat Used to format a DateTime in string form to a specified format (see http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx for format options) DateTimeFormat("March 1,2009", "MM/dd/yyyy") 03/02/2009 Eq Compares two values and returns True/False Eq("Value","Value") True EscapeDNtoString Creates a string that contains an escaped distinguished name EscapeDNComponent(dn) IIF Returns values based on if the condition is true or false IIF(Eq(1,1), "TrueText", "FalseText") TrueText Left Returns a specified number of characters from the left side of a string Left("LeftOnly",4) Left LeftPad Pads a string to a specified length using a provided padding character LeftPad("PadMe",10," ") PadMe Lowercase Converts all characters in string to lower case. LowerCase("MakeMeLower") makemelower LTrim Removes leading spaces Ltrim(" LTrimMe") LTrimMe Mid Returns specified number of characters from a specified position in a string Mid("XXMiddleXX", 3, 6) Middle ProperCase Converts the first character in a string to upper case and the rest to lower ProperCase("MakeMeProper") Makemeproper RandomNumber Returns a random number in a specified range RandomNumber(10,100) 67 (or some other integer) Right Returns a specified number of characters from the right side of a string Right("LeftRight", 5) Right RightPad Right-Pads a string to a specified length using a provided padding character RightPad("PadMe",10," ") PadMe (5 right spaces) Trim Removes leading and trailing spaces Trim(" TrimMe ") TrimMe RTrim Remove trailing spaces RTrim("RTrimMe ") RTrimMe UpperCase Converts all characters in a string to uppercase UpperCase("MakeMeUpper") MAKEMEUPPER Word Returns a word contained within a string based on parameters describing the delimiters to use and the word number to return Word("the quick sly fox",2," ") quick Eric
Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2009 6:25pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics