Writing a logon script for all the current Windows OSes is an exercise
in compromise.  The shell scripting of NT/2000/XP is much more robust
than that of Win9x and below.


Here are some of the issues which you face for this task:

* First, you have the issue of mapping drives, which is much more
flexible for  Win2K/XP than NT/Win9x/ME

* Next, the %USERNAME% variable is native to NT/2000/XP, but not to
Win9x/ME. Same for %DATE% and %TIME%

* Take the parenthesis out of the IF statements, since only the NT
family of OSes is happy to see those.

* Additionally, you should use quotes when comparing environment
variables.  For example:

if "%OS%"=="Windows_NT" net use u: \\server1\Users\%USERNAME% /yes


One way to get around the limitations mentioned above is to use is
VBScript (WSH).  Another option is Kixtart.


You may be interested in the following:

 http://www.ultratech-llc.com/KB/?File=OSType.TXT

 http://www.ultratech-llc.com/KB/?File=MapDrive.TXT

 http://www.ultratech-llc.com/KB/?File=HomeDirs.TXT

 http://www.ultratech-llc.com/KB/?File=Scripting.TXT


==============================================================
 ASB - http://www.ultratech-llc.com/KB/?File=~MoreInfo.TXT
==============================================================
 "Every absurdity has a champion to defend it."



>-----Original Message-----
>From: Rachael Lewis [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, September 13, 2001 6:09 PM
>To: NT System Admin Issues
>Subject: Multiple OSes and Login Scripts
>
>
>Hello all...
>
>I'm running Windows 2000 Server as a domain controller in a
>mixed client
>environment (Windows 2000/NT/Me/98/95).  I have attempted to create a
>generic login script that will map 2 drives to 2 different user
>directories (\\server1\users\%username% and
>\\server1\users\%username%\private)  Additionally, it will
>display the
>current date and time and a nice little MOTD.
>
>It runs wonderfully under Windows 2000.  Here are the
>problems I'm having.
>1.  On Windows 95/98/Me, I attempted to put an "else" after
>the "if %OS%"
>below that would say "net use u: \\server1\Users\rlewis".
>(meaning, I'd
>create a separate login script for each user running
>95/98/Me... luckily,
>that's not many).  It won't let me map a drive to the individual
>user-directory... just "Users".  Is there any way to make
>this automatic
>drive mapping work under 95/98/Me?
>
>2.  Under 95/98/Me, the "%date% %time%" doesn't work... just shows up
>blank... so, I had to add the "if %OS%=Windows_NT" so it
>would skip the
>lines on those OSes.
>
>3.  Even with the script below, I still get 3 syntax errors (I assume
>because of the "if" statements) on Windows 95/98/Me.
>
>I'm trying to do some simple stuff, and it seems pretty
>straightforward,
>but has been quite a pain in the neck.  Any ideas?
>
>Thanks!
>
>-- Rachael
>
>
>Here's the script:
>
>@echo off
>
>rem ** Map non-private home directory **
>if %OS% == Windows_NT (net use u: \\server1\Users\%USERNAME% /yes
>/persistent:no)
>
>rem ** Map private home directory **
>if %OS% == Windows_NT (net use p:
\\server1\Users\%USERNAME%\private /yes
/persistent:no)

if %OS% == Windows_NT echo Current date and time:  %date% %time%
echo.
echo **************************************************
echo *****                  MOTD                  *****
echo **************************************************
echo.
pause
exit


http://www.sunbelt-software.com/ntsysadmin_list_charter.htm

Reply via email to