IDM and DXCMD -getstate

  • 3772500
  • 21-Feb-2007
  • 26-Apr-2012

Environment

Novell Identity Manager Identity Manager 3.0

Situation

How the -getstate option in dxcmd functions. When accessing dxcmd via interactive prompts the getstate option for a driver returns the state correctly. However, when accessing dxcmd and passing the parameters via a batch, shell script, etc.. it does not return anything when using the -getstate option.

Resolution

It isn't designed to show the state, it is designed to return the state. When scripting, particularly on Unix, you often don't care about actually seeing the result. Rather, you want the result in a form that you can do something with it programmatically. The non-interactive dxcmd options (like -getstate) are designed to be used with scripting. So the dxcmd program returns the result as the (numeric) result of running the program. This means you can test the result and do something useful (such as translating the numeric value into a string and displaying it, if you were so inclined). In UNIX (most shells, anyway) you use $? in a shell script or on the command line to get the return value of the last program run. On Windows the syntax is %errorlevel%. For example. If you want to print out the state on Windows. Add the following as the last line in the dxcmd.bat file. "echo program return == %errorlevel%"

For IDM 3.5 an option (-s) has been added to dxcmd that causes the result to be written to stdout. This might be more straightforward to understand, but it is somewhat harder to use in scripting. In any event, the primary reason it was added was because of a limitation on the return value on many UNIX versions (including Linux). Basically, the program return value is limited to an unsigned 8-bit value. What this means practically is that error codes from eDirectory requests aren't intelligible when returned that way. To get around this limitation the -s option was added so that you can use the "backquote" shell method to put the dxcmd result into a form useful for scripting.

Feedback service temporarily unavailable. For content questions or problems, please contact Support.