Solved

can not get .bat file to work

Posted on 2006-06-17
11
297 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
11 Comments
 
LVL 96

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 96

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
Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

 
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
 
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 96

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Event ID: 2005 / Source: Microsoft-Windows-PerfNet 4 136
Connecting two servers 30 94
Cannot take ownership of a folder 8 91
Raising Forest Functional Level 9 67
by Batuhan Cetin Within the dynamic life of an IT administrator, we hold many information in our minds like user names, passwords, IDs, phone numbers, incomes, service tags, bills and the order from our wives to buy milk when coming back to home.…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 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