etautil in command prompt with local non-US characters.

Document ID : KB000008255
Last Modified Date : 14/02/2018
Show Technical Document Details
Issue:

We have a batch file which contains etautil scripts to do certain activities like explore account/sync users/assign role etc.

We execute this batch file and etautil commands are loaded in command prompts.

It has been observed whenever a reference to account/role is made where local characters are involved, the characters are loaded incorrectly which causes the script to fail.

We have tried to run such entries directly typing on command prompt, even then it does not work.

Here is a sample:

eTADSAccountName=Søren Wittchen Holm

This is not recognized when running the same in command prompt.

Cause:

This issue is due to the default code page in use into your MS command shell.
Type "mode con cp" or "chcp" from a dos prompt box; You will get the active CP.
By instance 437 for the United States.
Such a CP as 437 works fine with characters inside of the ASCII range of 0-127.
It is problematic outside of this range.

Resolution:
There are 2 solutions for this issue.
 
 
Solution #1.
Change the active console Code Page ahead in your script to deal with your local characters.
See https://ss64.com/nt/chcp.html
e.g. (with a french accented char):
@ECHO off
chcp 1252
SET ETAHOME="C:\Program Files (x86)\CA\Identity Manager\Provisioning Server"
%ETAHOME%\bin\etautil -u superadmin -p secret
update 'eTGlobalUserContainerName=Global Users,eTNamespaceName=CommonObjects,dc=im'
eTGlobalUser eTGlobalUserName=guiph01 eTTitle=Employé
 
 
Solution #2.
Use the -f etautil option to process the instructions from a file.
If so the MS command shell does not translate any of those characters inside the file.
The file is only processed by the etautil tool.
e.g.:
@ECHO off
SET ETAHOME="C:\Program Files (x86)\CA\Identity Manager\Provisioning Server"
%ETAHOME%\bin\etautil -u superadmin -p secret -f inputfile.txt
and inputfile.txt contains the update statement.