useraccountcontrol flags

ccsoitd1
ccsoitd1 used Ask the Experts™
on
I'm trying to use an autoit script to determine what combination of flags are in use on a local user account.

Whats the easiest way to do that?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Here is a link with all the flags.

http://support.microsoft.com/kb/305144

I have not used autoit so I do not know if there is an easy way. But there are other utilities out there that make this easier.
ADFIND
Powershell with Quest AD CmdLets or MS cmdlets.

Author

Commented:
i have that page, and i know what the flags are but what i'm not sure about is how to extract specific flags.

Auto it is very similar to vbscript, so if i could even get the vbs script to do it i can manipulate it to work in autoit.
While I'm a big AutoIT fan and you probably could do this with the AD UDF, even if it doesn't you can easily add to it as long as you know the object type
http://www.autoitscript.com/forum/index.php?showtopic=106163

But if you just want to list all users objects to CSV for example than I would recommend ADFind as ccsoitd1 suggested, it's very easy to use and will get you the results very quickly.

http://www.joeware.net/freetools/tools/adfind/usage.htm

Example:
ADFind.exe -b dc=domain,dc=co,dc=nz -f "&(objectcategory=person)(objectclass=user)" -nodn -csv {attribute1} {attribute2} -tdc>>ADUsers.csv

The {attribute*} can be exchanged for attributes like cn givenName if you only want to return these attributes or leave the {attribute}s out to return all results for the object/class.

I also use this in conjunction with AutoIT sometimes for example:
$RUN_ADFIND = Run(@ScriptDir & '\ADFind.exe -b dc=domain,dc=co,dc=nz -f "&(objectcategory=person)(objectclass=user)" -nodn -csv {attribute1} {attribute2} -tdc', '', @SW_HIDE, $STDOUT_CHILD)
$CHK_ADOUTPUT = ''
While 1
  $CHK_ADOUTPUT &= StdoutRead($RUN_ADFIND)
  If @errot Then ExitLoop
WEnd

If Stringinstr($CHK_ADOUTPUT, @CRLF) Then $VAR_ADOUTPUT = StringSplit($CHK_ADOUTPUT, @CRLF, 1)
....

You can then use the information as an array, split each line with comma and use the information within.

If you do know exactly what attributes you're looking for then you probably just use the AD UDF.

Hope that made sense.

Cheers

Author

Commented:
That was exactly the script i was looking for thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial