Solved

can not get .bat file to work

Posted on 2006-06-17
11
286 Views
Last Modified: 2010-04-18
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
Comment
Question by:lanivanvuuren
  • 5
  • 3
  • 3
11 Comments
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 16927463
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
 

Author Comment

by:lanivanvuuren
ID: 16927503
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
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 16927532
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
 
LVL 104

Accepted Solution

by:
Sembee earned 500 total points
ID: 16927616
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
 

Author Comment

by:lanivanvuuren
ID: 16930069
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 104

Expert Comment

by:Sembee
ID: 16930221
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
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 16930291
In the use tab for the logon script you just enter the name of the bat file, NOT the path.
0
 

Author Comment

by:lanivanvuuren
ID: 16930419
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
 

Author Comment

by:lanivanvuuren
ID: 16930544
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
 
LVL 104

Expert Comment

by:Sembee
ID: 16930786
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
 

Author Comment

by:lanivanvuuren
ID: 16931450
simon you are a star! thanks
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

So you have two Windows Servers and you have a directory/folder/files on one that you'd like to mirror to the other?  You don't really want to deal with DFS or a 3rd party solution like Doubletake. You can use Robocopy from the Windows Server 200…
by Batuhan Cetin In this article I will be guiding through the process of removing a failed DC metadata from Active Directory (hereafter, AD) using the ntdsutil tool in a Windows Server 2003 environment. These steps are not necessary in a Win…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 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