Link to home
Start Free TrialLog in
Avatar of Zebis_nz
Zebis_nz

asked on

Logon Script delete and remap drives

Hi all.... I run a simple logon script like below:
---------------------------------------------------------------------
@echo off
net time \\servername /set /yes

if "%OS%"=="Windows_NT" goto winnt

rem ------------Windows 9X Script----------------
net use p: \\servername\programs
net use r: \\servername\school

xcopy \\servername\programs\blueri~1.bmp C:\ /y
xcopy \\servername\netlogon\putinenv.exe %windir% /y
xcopy \\servername\netlogon\winset.exe %windir% /y
xcopy \\servername\netlogon\kx16.dll %windir%\system /y
xcopy \\servername\netlogon\kx32.dll %windir%\system /y
%windir%\putinenv.exe L
%windir%\winset.exe username=%username%$
%windir%\winset.exe langroup=%langroup%
@echo on
@echo %username%$
@echo off
net use h: \\servername\%username%$
START /W \\servername\netlogon\kix32 \\servername\NETLOGON\logon.scr
exit

rem ------------Windows 2k/xp Script----------------
:winnt
net use /persistent:no
net use * /delete /y

net use p: \\servername\programs
net use r: \\servername\school
net use h: \\servername\%username%$

\\servername\netlogon\ifmember.exe "Magazine Users"
if not errorlevel 1 exit
net use k: \\servername\magazine$
---------------------------------------------------------------------

Now the first problem I have is that in the Windows 2k/xp logon I dont have any mapped drives. If I rem the "net use * /delete" they are there. Its like the logon script just 'exits' after deleting any existing mapped drives.

Also even tho it works, I had to 'echo' the username in the win9x script for it to accept the varible in the mapping of h: drive. I dont know why? - Its been like this for a few years now but just never figured out why I had to do this.

Cheers - other suggestions welcome :)
Avatar of infotrader
infotrader

replace "if "%OS%"=="Windows_NT" goto winnt" with
"if %ostype%==NT goto winnt"

- Info
ASKER CERTIFIED SOLUTION
Avatar of idez_rsp
idez_rsp
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zebis_nz

ASKER

I *used* to run a slightly different script along the lines of:

if exist x: net use x: /delete /y
else etc...

But I thought there was a way to just *delete* all the currently mapped drives (thats if there any persistent ones).. then remap them...

Am I wrong in thinking that? Because then I think I ran into problems deleteing the home drive? Ill need to test it again.

Cheers,

Matt