Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

map.bat script

Status
Not open for further replies.

megan8

Technical User
Sep 12, 2006
4
US
Hi,
I have a domain controller and in the folder C:\WINNT\SYSVOL\sysvol\kato.local\scripts I have a script named map.bat that contains the following:

@echo off

net use f: /d
net use g: /d

net use f: \\katoapp02\sys
net use g: \\katomatic\kato_drive\kato

net time /DOMAIN:kato /set /y

g is our file server drive and f holds our company files for our erp system
under the in the active directory in each user profile on our network the logn script map.bat is listed.

for some reason all of the sudden the g drive is not mapping on anyone's computer they are not having access to it and we have programs that depend on this mapping and it is the most heavily used folder on our network I don't know what to do I have been trouble shooting this for an entire day and am without a clue. Has anyone ever experienced this before or can someone assist me in getting this to work?
Thanks
 
Just from a Quick look...
Check to make sure there isn't and issues with permissions being changed on the share or NTFS.

Have you tried to UNC to the path from a client that is having the issue? And can they connect?

 
My advice to you is to step up to using modern technology for this.

1. you should not use the Net Time anylonger. THis was an NT4 necessity, under WIndows 2000 the DC takes care of htis for you at login.

2. THe user property for Login Bat files is a legacy setting for integration with NT4.

You should be mapping your drives via GPO and switch over to vbscript. My FAQ on the subject will provide you with all thie information you need.

faq329-5798

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Thank you both, I will try the vbscript; I don't really know how to write vb script, is your example something I could just replace with my information on my network?
I did recreate my map.bat and now it is now working fine I think it became corrupt or something. But I really like what you describe in your faq.

Megan
 
Let me disagree with markdmac - there is NOTHING wrong with batch scripting. Microsoft is enhancing it (sort of) with the upcoming Monad.

I personally do not like using ONLY VBScript for logons because there are instances where windows machines don't support it... but all windows machines support batch scripting and a batch script can be written to take into account the 9x vs NT command environment.

Group Policy is great. Windows Scripting with vbscript can be great to - when it's appropriate.

I do agree, net time is pointless. Your users need to be admins to permit this to have any effect and the Windows Time Service should otherwise keep the systems time in sync to allow authentication.

What I would like to know is WHY isn't the G: drive mapping. When debugging logon scripts, just map a drive to the NetLogon share and run the script manually from a command prompt - you can see what happens - if you can't, remove any @ symbols that start off a line and remove the echo off line at the begginning. Then you can see what's happening, what error messages are appearing, and in doing so, you gain an understanding of why you are having problems. For example, perhaps some users have inserted USB Flash drives or card readers and the G: drive is not mapping because the letter is already in use. (In which case, vbScript wouldn't help you here).
 
I respect lwcomputings point of view. I will however point out that there are disadvantages with batch scripting.

1. it requires the creation of a virtual machine slowing down processing
2. the commands are very cryptic where vbscript is fairly easy to read
3. it is not as powerful as vbscript

vbscript has been supported on Windows machines since Windows 95. It is also supported on NT4. 9x and NT4 however do not process AD group policies. Neither should still be in production as workstations, they present significant security risks. 9x and NT4 have limited WMI support after installing the WMI core, so some more advanced scripts may not work on these platforms.

I don't think you can compare batch scripting to monad. Monad is an entire shell and language just like vbscript. There will not be a power shell written for the old platforms you have mentioned, so I think it unfair to compare.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
1. it requires the creation of a virtual machine slowing down processing
So? You're talking about a second... IF THAT. The speed impact is negligible. It has never affected me and I've written logon scripts that were quite long.

2. the commands are very cryptic where vbscript is fairly easy to read
Not really... some of the commands in a vbscript can end up being command line commands wrapped in a objShell.Run style statement. It's also considerably more complicated to write - keeping in mind that 3-11 lines can map drives and a printer in a batch file and in a vbs script it can take 10-70 lines depending on exactly what you want to check for and how you want to handle errors. You could say this is because VBS is flexible - but I can do virtually the same thing in a MUCH shorter batch file.

3. it is not as powerful as vbscript
You're right - batch files are MORE powerful than vbscript because you can use them and incorporate vbscripts and other utilities - and it's coding tends to be more efficient - a vbscript to do what a batch script can do can be 3-10x the size - which means the author has to have a greater understanding of the language in order to execute things whereas batch files can often just execute a simple command dedicated to checking/displaying information and then utilize that information.

vbscript has been supported on Windows machines since Windows 95. It is also supported on NT4. 9x and NT4 however do not process AD group policies. Neither should still be in production as workstations, they present significant security risks. 9x and NT4 have limited WMI support after installing the WMI core, so some more advanced scripts may not work on these platforms.
See point 6 and point 7 here:

Also, vbscript logon scripts require WSH be installed - yes, it's available for 9x systems, but then you have to get it installed before it can be useful.

With a little bit of environment variable testing or running of a tool like PSINFO, you can easily determine the OS and SP info and check for them in the batch file - if not NT, you can easily code for 9x alternatives. If WSH isn't installed the script simply does not run - there is NO CHANCE of any portion of it working. IF you know how to create batch programs, this is NOT a problem for batch files.

I prefer the KISS principal and for a variety of reasons, I don't view VBS as keeping it simple.

Again, vbs is a powerful tool... but essentially suggesting it is "wrong" to use batch files for logon scripts is, in my opinion, wrong.
 
I'll just add one more comment here and be done with the debate. If you have to install WSH then you have a problem at this point since WSH 5.6 is installed with IE 5.5 SP1, a lesser version of the engine was installed with IE 5. If you are not running that as a minimum version of IE then your worries are considerable larger than being able to process a login script since these versions have many security flaws.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top