Refining findstr search results

Created: 2018-12-19 11:13:14
Modified: 2024-10-16 16:07:34
Tags: Custom Mapping Errors Exclusions Javascript LDIF Troubleshooting UnitySync

When you have a lot of connections, it may be difficult to remember the exact configuration of each and/or compare their settings if necessary. (Without flipping between the connections in the UI).

The connection config data is in config.txt of each connection. Consider using findstr to search/output configuration data from a CMD prompt.

Start > CMD Prompt
C:\
CD \UnitySync\Connections

As an example, if you want to output the sync container Placement DN (aka destsubtree) you’d run similar to:

Example findstr on all connections' config.txt

run findstr /S /c:"destsubtree=" config.txt >AllDestsubTree.txt

Parameters:

/s will search ALL config.txt files in subdirectories

/i can be used if you aren’t sure of the case

Output includes the file name and the line where the string was found.
/c: allows for multi value string (without /c each search term is taken individually.

i.e. The second example below will return fewer results as it’s looking for the string “Search term” and not “Search” and “term” individually.

findstr “search term”
vs
findstr c:/“search term”

Sample output in AllDestsubTree.txt

AD1 to AD2\config.txt:destsubtree=ou=AD1Contacts,ou=ExternalGal,dc=Domain2,dc=com
AD3 to AD2\config.txt:destsubtree=ou=AD3Contacts,ou=ExternalGal,dc=Domain2,dc=com
AD1 to AD3\config.txt:destsubtree=ou=AD1Contacts,ou=Outside Contacts,dc=Domain3,dc=com 

You could then further refine the data to search for specific destinations by doing a findstr on AllDestsubTree.txt (no /S needed, it’s just one file)

Example findstr on single file:

run findstr /i /c:"dc=domain2" AllDestsubTree.txt > Domain2.txt

Sample output in Domain2.txt
AD1 to AD2\config.txt:destsubtree=ou=AD1Contacts,ou=ExternalGal,dc=Domain2,dc=com AD3 to AD2\config.txt:destsubtree=ou=AD3Contacts,ou=ExternalGal,dc=Domain2,dc=com

Similar search strings can be used to search map files, logs, etc.

cd \UnitySync\global\map\custom
findstr /i /c:"description=" *

cd \UnitySync\connections\AD1 to AD2\Logs
findstr /i /c:"Run Time" *sync.txt

The /c: parameter specifies a single string to search for. You may use more then one /c: parameter. Such as:

cd \UnitySync\Connections\AtoB\log
findstr /i /c:"Database Message" /c:"LDAP Message"  2024-10-02-11-32-25-sync >error.out

Finally, you may return lines prior to or following the text you are searching for. Such as:

cd \UnitySync\Connections\AtoB\log
findstr /i /c:"Database Message"  2024-10-02-11-32-25-sync >error.out

Refer to this link for additional information on findstr syntax:
https://technet.microsoft.com/en-us/library/bb490907.aspx

Knowledgebase

Directory
  1. Directify - Self Service

  2. Mimic - Replication

  3. UnitySync - Sync
Password
  1. emPass - Sync
Obsolete
  1. Profiler
  2. SimpleSync