Help - Search - Members - Calendar
Full Version: Logon Scripts....
Neowin Forums > Windows Support > Windows NT4/2000/2003/2008 Server
Ilyes
I have a logon script for every department in my office and basically it makes sure that the Anti-Virus is in place and also that all of the mapped drives are mounted. Currently, the way its setup is first...I make sure the drives are removed using the following command:


net use s: /del
net use f: /del
net use h: /del
net use j: /del
net use x: /del
net use z: /del

Then, I mount them

net use s: \\shire\apps
net use f: \\borg\rw
net use H: \\borg\%USERNAME%
net use J: \\borg\shared
net use x: \\10.1.16.20\groups foscht /user:bhs\tforscht
net use z: \\192.168.60.10\parts docs


For some reason, this configuration doesn't really work 100% of the time..I don't know what it is....but it doesnt. Is there a command I can issue before the mounting commands (the second set I listed above) that will remove all drives? OR Am I doing something wrong?

Please help!
rtano
if exist s:


i suggest you to use VBS instead of bat.
Joel
Why remove them at all? Do your clients create random drives during the day?
Eversurf
Check the help in the net use command you might be able to find it there.

I believe the command is net use * /del
amfony
things 2 think about

anything with a space in it like ur example of groups foscht should be enclosed with quotation marks - the space inbetween acts as a delimiter which is not what we want here.

secondly the some of the letters are in capitals - now i KNOW this shudnt make a lick of differnce but uniformity is the key to good troubleshooting.

also make sure u have routes or ip's that will make sure u can access thoes resources on thoes IP Addresses (IE make sure you can ping them)

Make sure u have appropriate ACL's to be able to access the resources - and as the users who will logging in using this script

Apart from that it should work no worries - however ur problem might not be with the script but with perhaps DNS or WINS - more likely dns if its a 2k + system.
If so then that is another kettle of fish ... let me know how you go.


travelcard
You should use this probably.

CODE

@echo off
break off
cls
net use * /d /y >nul
net use s: \\shire\apps >nul
net use f: \\borg\rw >nul
net use H: \\borg\%USERNAME% >nul
net use J: \\borg\shared >nul
net use x: "\\10.1.16.20\groups foscht" /user:bhs\tforscht >nul
net use z: "\\192.168.60.10\parts docs" >nul


That will tidy things up a bit, but if you're finding that the script works *some* times then you need to look elsewhere.

More than likely it's the "Fast logon optimization" feature in Windows XP. That needs to be disabled on a network and also you need to force "always wait for network at logon"
Do you have a Windows 2000 or 2003 server and are all your clients XP?
Ilyes
QUOTE(travelcard @ Dec 16 2004, 22:51)
You should use this probably.

CODE

@echo off
break off
cls
net use * /d /y >nul
net use s: \\shire\apps >nul
net use f: \\borg\rw >nul
net use H: \\borg\%USERNAME% >nul
net use J: \\borg\shared >nul
net use x: "\\10.1.16.20\groups foscht" /user:bhs\tforscht >nul
net use z: "\\192.168.60.10\parts docs" >nul


That will tidy things up a bit, but if you're finding that the script works *some* times then you need to look elsewhere.

More than likely it's the "Fast logon optimization" feature in Windows XP. That needs to be disabled on a network and also you need to force "always wait for network at logon"
Do you have a Windows 2000 or 2003 server and are all your clients XP?
[right][snapback]585113250[/snapback][/right]



WOW! Thank you so much! I will try this out immediately!
Eversurf
When it doesn't work is it the whole thing or just some part of it?

If it's some part which part is it.

I see two networks in there. The first one that start with 10 and the one starting by 192.
Ilyes
Actually, what happens is..the users create their own drives all across the network and that is where my problem is...So first, I wanted to figure out how to issue a command so that all of the drives are basically deleted everytime the machine logs on and then it adds the drives every session.

I attached my latest script above...I am getting errors about the network not being available or an error 67?


And yes, we have 4 networks

10.1.16*
192.168.60*
192.168.80*
192.168.85.*

travelcard
Thanks Eversurf, I hadn't even noticed that.

Yes, cultavix, what you have there is a very unusal setup and to be honest is bound to be causing problems. I presume the different networks are down to security issues or the remains of old networks that haven't quite been removed fully yet.

If you post exactly what you have in terms of operating systems and the reason for the different networks then we may be able to point out improvements (or total network reconfiguration tongue.gif )
_Ombra_
Cultavix,

if you want to launch the command at each log on you don't need to delete everything on start, you can delete the line with "net use * /d /y >nul" and instead add " /persistent:no" to all the other lines. This command allows you to disconnect network drives at each log off or restart. The thing should look like this:

CODE
@echo off
break off
cls
net use s: \\shire\apps /persistent:no >nul
net use f: \\borg\rw /persistent:no >nul
net use H: \\borg\%USERNAME% /persistent:no >nul
net use J: \\borg\shared /persistent:no >nul
net use x: "\\10.1.16.20\groups foscht" /user:bhs\tforscht /persistent:no >nul
net use z: "\\192.168.60.10\parts docs" /persistent:no >nul


hope this helps

BTW: I'm still searching for someone to help me with a Remote Installation problem with Windows 2003 tongue.gif
The Nonentity
QUOTE(travelcard @ Dec 16 2004, 17:51)
You should use this probably.
More than likely it's the "Fast logon optimization" feature in Windows XP. That needs to be disabled on a network and also you need to force "always wait for network at logon"
Do you have a Windows 2000 or 2003 server and are all your clients XP?
[right][snapback]585113250[/snapback][/right]


How does one disable Fast logon optimization in Windows XP? I disabled always wait for network at logon and Fast logon optimization is something I have never heard of.
travelcard
QUOTE(_Ombra_ @ Dec 18 2004, 14:55)


BTW: I'm still searching for someone to help me with a Remote Installation problem with Windows 2003 tongue.gif


Hi, I've posted something for you on that thread.
travelcard
QUOTE(The Nonentity @ Dec 18 2004, 16:07)
How does one disable Fast logon optimization in Windows XP? I disabled always wait for network at logon and Fast logon optimization is something I have never heard of.
[right][snapback]585122466[/snapback][/right]


Sorry, I was rambling when I posted that. I should have said that you disable Fast logon optimization BY disabling "always wait for network at logon"

In the group policy it's at:

Computer Configuration \ Administrative Templates \ System \ Logon \
Always wait for the network at computer startup and logon

As the policy says - Xp doesn't wait for the network during logon unless you are using a romaing profile. You may notice that 'some' people don't get their mapped drives sometimes, this is usually the reason.
WinMaster
This is how you can have all mapped drives cleared before your script runs. Simply add this line first: "net use * /delete /y"

--WinMaster
Ilyes
Thanks to everoyne for their input. I am going to test the script out. You can check out my final outcome, attached to this post.

Comment as you'd like...

NOTE: HAH. I couldnt upload the .bat file so....right click the image, save image to ur desktop or whatever, then rename it to .bat wink.gif
The Nonentity
Is the MOVEON section for Symantec AntiVirus program? What is VP_Log32?
travelcard
Well one quick impression is that the first two lines should be
@echo off
break off

They lose their use if they are put further down the script. @echo off stops all the lines off your script from being outputted to the screen while it's being run. Break off stops someone pressing "CTRL C" to cancel the script.
travelcard
Also you have theses two lines:

CODE

@SET LANG=ENU
@SET FILE_SERVER=BORG


are they working how you want? You are setting environment variables there, but that only sets 'user' environment variables. If you want to set 'system' environment variables you'll need to use the resource kit file 'setx', you should be able to get it from Microsoft - PM me if you ca't get it. If it's working how you expect then that's fine, I know we've had problems with it before.
travelcard
Here is your current logon script for others to see:

CODE

@SET LANG=ENU
@SET FILE_SERVER=BORG
@ECHO OFF

\\melkor\netinstall\logon\NILogin.cmd

net use * /delete /y

break off
cls
net use s: \\shire\apps /persistent:no >nul
net use f: \\borg\rw /persistent:no >nul
net use H: \\borg\%USERNAME% /persistent:no >nul
net use J: \\borg\shared /persistent:no >nul
net use x: "\\10.1.16.20\groups foscht" /user:bhs\tforscht /persistent:no >nul
net use z: "\\192.168.60.10\parts docs" /persistent:no >nul


rem %0\..\NBPSHPOP +T: \\BORG\vplogon

if "%OS%" == "Windows_NT" goto WINNT_NBPSHPOP

%0\..\NBPSHPOP +T: \\BORG\vplogon

goto MOVEON

:WINNT_NBPSHPOP

NBPSHPOP +T: \\BORG\vplogon

:MOVEON

T:\OSVER
IF ERRORLEVEL 2 GOTO WIN_32
GOTO 16BIT

REM *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*

:WIN_32
  T:\VP_Log32 /p=T:
  GOTO END

REM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

:16BIT
  T:\VP_Log16 /l=%LANG% /p=T:\ /n=4

REM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

:END

rem %0\..\NBPSHPOP -T:

if "%OS%" == "Windows_NT" goto WINNT_NBPSHPOP_END

%0\..\NBPSHPOP -T:

goto MOVEON_END

:WINNT_NBPSHPOP_END

NBPSHPOP -T:

:MOVEON_END


rem - Begin global mappings




rem - Begin global mappings
travelcard
Do you use Windows 9x anywhere on your network? If so then
CODE
net use * /d /y

will cause the script to fail. 9x uses the Z: drive to connect to the logon folder in order to run the script (that's also why if you map a drive using Z: it will fail). So, if you have 9x the script will run from Z:, but if you have 'net use * /d /y' in your script that will disconnect all current drives including Z: meaning it can no longer read the remaining lines of the script. That one gave us some headaches I can tell you.
leggom
I have this at the beginning of my script, it deletes all drives:

NET USE /PERSISTENT:NO
NET USE * /DELETE /YES
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.