Use eDirectory identifier variable in login script NET USE command

  • 7016037
  • 07-Jan-2015
  • 07-Jan-2015

Environment

Novell Client 2 SP3 for Windows

Situation

The administrator wants to map a drive in the container login script to a Microsoft share using the NET USE command. Since multiple users will access this script, the username will need to be inserted into the command.

Resolution

Because the @ login script command simply passes the specified command to a Windows command processor to execute, you cannot use eDirectory identifier variables such as "CN" directly in the NET USE command. It is necessary to first set a Windows environment variable to the value of the eDirectory identifier variable, and then use the Windows environment variable in the NET USE command.

For example:

;This line sets a Windows environment variable named "MYCN" equal to the 
; eDirectory identifier variable named "CN".
SET MYCN="%CN"
;This line displays the Windows environment variable you just set (optional).
WRITE "MYCN = %<MYCN>"
;This line executes the command by launching a command prompt and passing
;the command to the command processor.
@NET USE H: \\my_share_name /user:my_domain_name\%<MYCN>

Substitue the actual share name in the place of "my_share_name" and the actual domain for "my_domain_name".

Additional Information

For more information on using eDirectory identifier variables, see the Novell Login Scripts Guide.