Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

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>
0
lanivanvuuren
Asked:
lanivanvuuren
  • 5
  • 3
  • 3
1 Solution
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
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.
0
 
lanivanvuurenAuthor Commented:
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

?




0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Of course - why couldn't you?  My question is, why did you have this - <file:\\Br-data-server\INSTALLS> - there in the first place?
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
SembeeCommented:
If I was writing a similar script, this is what I would do...

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 M: \\Br-data-server\WORD FILES
NET USE N: \\Br-data-server\EXCELL FILES
NET USE O: \\Br-data-server\PUBLISHER FILES
NET USE P: \\Br-data-server\DIGITALPHOTOS
NET USE Q: \\Br-data-server\CHAOS
NET USE R: \\Br-data-server\EZCAMP FILES
NET USE S: \\Br-data-server\INSTALLS

You will note a couple of differences.

1. I have set the persistence at the top. That means that the drives that are mapped are not remembered.
2. I have put a space before the /delete

Another thing you might want to do is change the script.
Save this file as login2.bat and then put in to login.bat the following:

login2.bat >%systemdrive%\login.txt

That will run the script login2.bat but record the results in a text file. You can then see what is happening.
You can get clever with the recording of the script results to include the date and time. I have details on that on my web site: http://www.amset.info/loginscripts/recording.asp

Simon.
0
 
lanivanvuurenAuthor Commented:
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
0
 
SembeeCommented:
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.

0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
In the use tab for the logon script you just enter the name of the bat file, NOT the path.
0
 
lanivanvuurenAuthor Commented:
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
0
 
lanivanvuurenAuthor Commented:
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
0
 
SembeeCommented:
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.
0
 
lanivanvuurenAuthor Commented:
simon you are a star! thanks
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 5
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now