JSI Tip 9912. How can I use environment variables to define commonly used ADFind.exe freeware switches?


The new version of ADFind.exe freeware allows you to create and recall environment variables for switch setting:

-e xxx        Load switches from environment. Will read env vars with prefix
              and dash (adfind-) by default and load them in. Any switches
              specified explicitly on the command line will override. To
              specify a different prefix, specify string after -e. For
              example to specify the host switch create an env var of
              adfind-h. To specify properties specify the env var adfind-
              or adfind-props. To specify a switch that doesn't take a
              a value, specify a value of \{~\} because you can't set a
              an environment variable to blank.
                 Ex: Queries ADAM on localhost port 5000 for subnets.
                    set adam1-h=.:5000
                    set adam1-config=\{~\}
                    set adam1-f=objectcategory=subnet
                    set adam1-props=name siteobject
                    adfind -e adam1

Sample:

set csv-default=\{~\}
set csv-bit=\{~\}
set csv-nodn=\{~\}
set csv-tdc=\{~\}
set csv-tdcs=\{~\}
set csv-samdc=\{~\}
set csv-csv=\{~\}
set csv-csvdelim=;
set csv-csvmvdelim=#
adfind -e csv -nocsvheader -f "&(objectcategory=Person)(objectClass=User)" sAMAccountName distinguishedName userPrincipalName MemberOf userAccountControl lastLogon
The output might look like:
"Test";"CN=Test.User,CN=Users,DC=JSIINC,DC=COM";"[email protected]";"CN=Accounts Payables,CN=Users,DC=JSIINC,DC=COM#CN=accountants,CN=Users,DC=JSIINC,DC=COM";"66048 \[NORMAL_USER(512);NO_EXPIRE(65536)\]";"2005/11/15-23:55:00 Eastern Standard Time"
NOTE: See the following tips:
How can I save and recall the switches I use with ADFind.exe freeware?

ADFind.exe freeware can use :AND: and :OR: instead of :1.2.840.113556.1.4.803: and :1.2.840.113556.1.4.804: to define a bitwise filter.

ADFind.exe freeware allows you to save and recall query filters.



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish