Putting User's Current Context into Registry
Novell Cool Solutions: Tip
By Bradford Thorpe
|
Digg This -
Slashdot This
Posted: 27 Sep 2000 |
Current Version: ZENworks for Desktops 3
I had an interesting problem of trying to get an app to put the current context of the user into the registry. As I couldn't find a macro to use I ended up using a batch file in the script and then regedit command.
The batch file looked like this..
@echo off
copy \\%path%\context.reg %home directory%
cx >> %home directory%\context.reg
type \\%path%\comma.txt >> %home directory%\context.reg
%*WinDir%\regedit /s %home directory%\context.reg
del %home directory%\context.reg
Basically I just appended the cx command into a pro-forma reg file. Comma.txt is just a " to finish the reg file. Then silently inserted the registry file.
Works fine for me. If anyone knows any other way to do it I would appreciate knowing.
If you have any questions you may contact Bradford at bradford@mailandnews.com
Other Ideas
Markus Brandt NEW
There's another method of getting the user's context into the registry.
Advantage: You don't have to prepare two text files (context.reg + comma.txt). You can also use the NT variable containing the context whereever you want (e.g. within the batch file: if %Context%==.ORG ...)
Just copy the following lines into a Windows NT batch file:
@echo off
for /f %%v IN ('cx') DO set Context=%%v
REM Get screen output of cx command into Variable
echo User context is: '%Context%'
set Filename=c:${BS}temp${BS}help.reg
echo REGEDIT4>%TempFile%
echo.>>%TempFile%
echo [HKEY_LOCAL_MACHINE\SOFTWARE\ Novell\NWGINA\Login Screen]>>%TempFile%
echo "DefaultNDSContext"="%Context%">>%TempFile%
regedit -s %TempFile%
del %TempFile%
goto :EOF
If you have any questions you may contact Markus at markus.brandt@web.de
Paul Langton NEW
I have had the same issue, and there is a macro that is the current users context, it is %REQUESTER_CONTEXT%
A small note, it would be really great for a web page that had ALL the macros NAL can use. There is currently no such thing as far as I can find, the help in NetWare Administrator is nowhere near a complete list, and the various web pages I have found also do not have all of them (for instance, the one I used above).
We agree. Everyone send what you've got and we'll compile a list.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

