Solved

Logon Script delete and remap drives

Posted on 2004-04-26
3
671 Views
Last Modified: 2008-02-01
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 :)
0
Comment
Question by:Zebis_nz
3 Comments
 
LVL 11

Expert Comment

by:infotrader
ID: 10923582
replace "if "%OS%"=="Windows_NT" goto winnt" with
"if %ostype%==NT goto winnt"

- Info
0
 
LVL 1

Accepted Solution

by:
idez_rsp earned 250 total points
ID: 10925779
I think your problem is that when the Logon Script executes it's actually doing so as a mapped drive.  (Z:) And you are removing ALL the drive Mappings.  So it can't continue execution when it would get to the next instruction.

Try Manually deleting any drives you need to map prior to mapping them.

Good Luck!

R.
0
 
LVL 1

Author Comment

by:Zebis_nz
ID: 10927153
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
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello I read in a discussion about a person who configured a very simple mirror RAID with two hard drives; the system and data were on the same partition. He asked how to repair the system as it was not booting up anymore. In his case running …
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question