Here is an edited version of a rather elaborate script I wrote for some basic device control.
Calling convention:
lc [device] [command] [misc]
device is a 2-char code I associate with a device
/dev/rmt0.1 = i0, /dev/rmt1.1 = i1, and so on
command is a 2/3-char command, I have several, only
implement 2 of them here: on and off
misc is used by some of my other commands
/root/lc
[tt]#!/bin/ksh
# ${1} = device
# ${2} = cmd
QUIT=0
case "${1}" in
""

DEVICE=/dev/rmt0.1
;;
"i0"

DEVICE=/dev/rmt0.1
;;
"i1"

DEVICE=/dev/rmt1.1
;;
"i2"

DEVICE=/dev/rmt2.1
;;
"i3"

DEVICE=/dev/rmt3.1
;;
*)
exit
;;
esac
case "${2}" in
""

nsrmm
;;
"on"

case ${1} in
"i1"|"i2"|"i3"

MEDIA="3590"
;;
*)
echo "lc.on: unknown device"
exit
;;
esac
TMP=/tmp/$$
QUERY="name: \"${DEVICE}\"; media type: \"${MEDIA}\""
rm /tmp/${TMP} 2>/dev/null
echo ". ${QUERY}" >> ${TMP}
echo "update enabled: Yes" >> ${TMP}
nsradmin -i ${TMP} >/dev/null
rm ${TMP} 2>/dev/null
;;
"off"

case ${1} in
"i1"|"i2"|"i3"

MEDIA="3590"
;;
*)
echo "lc.on: unknown device"
exit
;;
esac
TMP=/tmp/$$
QUERY="name: \"${DEVICE}\"; media type: \"${MEDIA}\""
rm /tmp/${TMP} 2>/dev/null
echo ". ${QUERY}" >> ${TMP}
echo "update enabled: No" >> ${TMP}
nsradmin -i ${TMP} >/dev/null
rm ${TMP} 2>/dev/null
;;
*)
nsrmm
;;
esac