Using findstr to locate text in your UnitySync config/log files

Created: 2015-03-12 12:05:05
Modified: 2024-03-01 09:33:33
Tags: Custom Mapping Javascript Perl System Requirements Troubleshooting UnitySync

It is sometimes necessary to find text in a connection configuration or log file. Examples of this might be:

  • You want to identify all connections using a specific IP address
  • You want to identify all connections using a specific engine type (i.e., ODBC)
  • You want to identify all custom object map files that utilize scripting (searching for & char)
  • You want to determine if a specific attribute is mapped in any of your custom map files

There is no way to do this type of text search in the UntiySync User Interface (UI), and Windows Explorer doesn’t perform this task very well, either. We’ve outlined the exact steps, below, for using findstr to aid your search of text to accomplish the tasks above.

A) Using findstr to identify all connections using a specific IP/hostname:

  • Open CMD prompt.
  • CD into your \UnitySync-v2.x\connections directory.
  • Run findstr as shown below:

Note: In your UnitySync connection, the IP maybe an numerical IP or a hostname. You need to search for the text exactly as it is identified in the Configured Directories box on the UI Launch Page.

>>findstr using IP address:
findstr /S /c:"127.0.0.1" config.txt

Sample Output:
DirA to DirB\config.txt:sourceip=127.0.0.1
DirB to DirA\config.txt:destip=127.0.0.1

>>findstr using hostname:
findstr /S /c:"ServerX" config.txt

Sample Output:
DirA to DirB\config.txt:destip=ServerX DirB to DirA\config.txt:sourceip=ServerX

B) Using findstr to identify all connections using a specific Engine type (i.e. ODBC, activedir):

  • Open CMD prompt.
  • CD into your UnitySync-v2.4\Connections directory
  • Run findstr as shown below:

>>findstr for engine type
findstr /S /c:"ODBC" config.txt

Sample Output:
DirC to DirD\config.txt:engine=odbc-ldap DirD to DirC\config.txt:engine=ldap-odbc

C) Using findstr to identify all custom object map files that utilize scripting

Any instance of & in a custom map file indicates the use of scripting.

  • Open CMD prompt.
  • CD into specified directory.
  • Run findstr as shown below:

>>findstr for scripting
CD into your \global\map\custom
findstr /S /c:"&" *person.txt

Sample Output:
pullmap-person.txt:company#64=&DropDigits("^company^") &
pushmap-person.txt:displayname#256=&uc("~cn~") &

>>findstr to determine which connections use custom map files

CD into \connections directory
findstr /S /i /c:"map-person" config.txt

Sample Output:

Connection1\config.txt:map-person=MycustomMap-person.txt
Connection2\config.txt:map-person=
Connection3\config.txt:map-person=AnotherCustomMap-person.txt

(Note: The blank simply means the connection does not use a custom file.)

D) Using findstr to determine if a specific attribute exists in your custom object map files

  • Open CMD prompt.
  • CD into your \global\map\custom directory.
  • Run findstr as shown below:

>>findstr for scripting
\findstr /S /c:"unicodepw" *person.txt

Sample Output:
createuser-person.txt:unicodepw=deFaultpw7

More tips for Refining Findstr Results

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