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\blue ri~1.bmp C:\ /y
xcopy \\servername\netlogon\puti nenv.exe %windir% /y
xcopy \\servername\netlogon\wins et.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\kix3 2 \\servername\NETLOGON\logo n.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\ifme mber.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 :)
--------------------------
@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\blue
xcopy \\servername\netlogon\puti
xcopy \\servername\netlogon\wins
xcopy \\servername\netlogon\kx16
xcopy \\servername\netlogon\kx32
%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\kix3
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\ifme
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 :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
"if %ostype%==NT goto winnt"
- Info