Link to home
Start Free TrialLog in
Avatar of lanivanvuuren
lanivanvuuren

asked on

can not get .bat file to work

HELP pleaze... I had to replace our domain server and is trying to get the login.bat file to work so that when users sign on they automaticlaly get some files mapped.  I have tried it now a couple of ways in differnt ways as well here is a copy of the latest - just a little history - it kept on holding on to the old mapped drives so I wrote this delete to get that away - nothing is really working and I want to pull my hair out - don't worry will not do it but you know the feeling. I called the file login.bat and in each users logon script under profile in active directory I have login.bat I saved that file in: C:\WINDOWS\SYSVOL\domain\scripts

On the server I first only made the main folder all these folders are in shared... so that everybody could just see it... then I thought that must be the problem and I made each indivisuatl category folder shared... that did not want to work.. so I ended up mapping the folders on the server and this is what I end up with... so please help I need to get this done and I'm sure it is just something stupid that I have wrong but can not seem to fix it. Is there away to set up printers this way too???  Thanks lani

ps: here is that login.bat file content

ECHO OFF
NET USE F:/DELETE
NET USE G:/DELETE
NET USE H:/DELETE
NET USE I:/DELETE
NET USE J:/DELETE
NET USE K:/DELETE
NET USE L:/DELETE
NET USE T:/DELETE
NET USE U:/DELETE
NET USE V:/DELETE
NET USE W:/DELETE
NET USE X:/DELETE
NET USE Y:/DELETE
NET USE Z:/DELETE
NET USE M: \\Br-data-server\WORD FILES <file:\\Br-data-server\WORD FILES>
NET USE N: \\Br-data-server\EXCELL FILES <file:\\Br-data-server\EXCELL FILES>
NET USE O: \\Br-data-server\PUBLISHER FILES <file:\\Br-data-server\PUBLISHER FILES>
NET USE P: \\Br-data-server\DIGITALPHOTOS <file:\\Br-data-server\DIGITALPHOTOS>
NET USE Q: \\Br-data-server\CHAOS <file:\\Br-data-server\CHAOS>
NET USE R: \\Br-data-server\EZCAMP FILES <file:\\Br-data-server\EZCAMP FILES>
NET USE S: \\Br-data-server\INSTALLS <file:\\Br-data-server\INSTALLS>
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

What do you mean by:

<file:\\Br-data-server\INSTALLS>

Are you actually including that in the script?  If so, that's one problem - < and > are input/ouput redirectors and cannot be used in a batch file the way you are apparently using them.
Avatar of lanivanvuuren
lanivanvuuren

ASKER

the server name is Br-data-server  INSTALLS is just a folder name (was named that before so I left it that way)  can I just then make it

NET USE S: \\Br-data-server\chaos

?




Of course - why couldn't you?  My question is, why did you have this - <file:\\Br-data-server\INSTALLS> - there in the first place?
ASKER CERTIFIED SOLUTION
Avatar of Sembee
Sembee
Flag of United Kingdom of Great Britain and Northern Ireland 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
Hey there,

I did what Simon asked and that makes totally sense... here is what I found - I went and checked the login.txt seems like script wise it is all working will except that I had to take out the spaces of "work file"  when I log onto the server as the user just to test the drives mapped BUT when I logged onto the workstations it did not do anything - like it did not see the login.bat from the server... here is where I put it and what I put in the user info

C:\WINDOWS\SYSVOL\domain\scripts\login.bat

In the userer profile under logon script I have: login.bat

any ideas what will cause it not to see the script?


Thanks
I made a mistake.
You need to enclose any shares with spaces in their names in " "

For example:

"\\Br-data-server\EZCAMP FILES"

If you put in the following in to a workstation can you see the script:

\\domain.com\netlogon

where domain.com is your domain name.

Simon.

In the use tab for the logon script you just enter the name of the bat file, NOT the path.
seems like I might have a dns setting issue - the current scrip is as follow (I renamed the shared folders so that they it does not have any spaces in them and did the same with the actual folder name and then fix the script.

It them came to my attention that dell yet again dropped the ball and what seemed to be a newly working dns domain set up is not since any newly created domain user can not log on the network... that will most probably explain why the old users had issues with the login.bat files - they most probably only get logged on locally instead of via the domain (since they already logged on as them selves before the new domain on the local workstation) here is what is intersting they 3 of the maps actually get mapped - those use to be the ones that did not have any spaces in the name BUT non of the rest get mapped.  After I realize this I changed the folder etc names ... I'm changing the map letters at the moment to test and see if the old domain users mapped letter change as well... that will be instersting since I don't think they are fully seeing the domain domain wise (nope everything on the workstations are set up correcting and pointing to the new domain etc... can also ping it back and forth just seems something with the domain settings are not too correct.

ECHO OFF
NET USE /persistent:no
NET USE F: /DELETE
NET USE G: /DELETE
NET USE H: /DELETE
NET USE I: /DELETE
NET USE J: /DELETE
NET USE K: /DELETE
NET USE L: /DELETE
NET USE M: /DELETE
NET USE N: /DELETE
NET USE O: /DELETE
NET USE P: /DELETE
NET USE Q: /DELETE
NET USE R: /DELETE
NET USE S: /DELETE
NET USE T: /DELETE
NET USE U: /DELETE
NET USE V: /DELETE
NET USE W: /DELETE
NET USE X: /DELETE
NET USE Y: /DELETE
NET USE Z: /DELETE
NET USE W: \\Br-data-server\WORD
NET USE X: \\Br-data-server\EXCELL
NET USE P: \\Br-data-server\PUBLISHER
NET USE F: \\Br-data-server\DIGITALPHOTOS
NET USE Q: \\Br-data-server\CHAOS
NET USE M: \\Br-data-server\EZCAMP
NET USE W: \\Br-data-server\INSTALLS
well here is a good lesson for all - NEVER TRUST DELL!!!!!!!!!!! it ended up that I do have to now go to each work station - and REjoin the domain - seems like my scrip will then work - well atleast now I know and will never have to ask again about .bat file for network mapping...   so is there a script like the .bat for mapping that will actually add a printer to the workstation since that also seems to be more user orientated then computer orientated?

Thanks for all your help!!!

Lani
There are a couple of ways of doing printers.

The NT Resource Kit utility con2prt (which also works on more modern OS) and the built in rundll system.

I have covered both on my web site:

http://www.amset.info/loginscripts/printers.asp

Simon.
simon you are a star! thanks