Solved

Logon Script delete and remap drives

Posted on 2004-04-26
3
663 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction Often we come across situations wherein our batch files would be needing to reboot Windows for a variety of reasons. A few of them would be like: (1) Setup files have been updated whose changes can take effect only after a reboot …
Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now