Question

Locked

Login Script Help

By jsizer ·
O.k. what I am trying to accomplish is that I delete all mapped drives when the script starts and then map them to a home and common drive and then map the department drives by group membership. I have donwloaded some examples and edited them accordingly. I have them all seperate to see if they work on an individual basis at the moment. What I have an issue with is if I map a drive manually the disconnect won't work, it tells me the drive doesn't exist but I SEE IT in My computer. How is is possible that it thinks that it doesn't exist... Is there a difference between mapping a drive manually and mapping through a VBS? I wouldn't think that would be different however if I manually disconnect the H and run the script to map it, it appears and then if I run the next script to unmap it disappears...

Any thoughts, suggestions or help is greatly appreciated!

here is the script for disconnecting the drive

Option Explicit
Dim objNetwork, strDriveLetter
strDriveLetter = "H:"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.RemoveNetworkDrive strDriveLetter
Wscript.Quit

After further investigation just now I see that it is disconnecting the drive but I want it to delete the mapping complete. I does not do that.

Thanks,

Jennifer

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Had a similar problem with mixed results.

by 1bn0 In reply to Login Script Help

Please review this posting.

http://techrepublic.com.com/5208-6230-0.html?forumID=101&threadID=265915

The delete all drives part worked fine. However, there does not seem to be any precedent between the logon script and the personal folder being mapped from the user profile. e.g. Sometimes the personal folder will map first and then the logon script deletes it.

One recommendation. (i believe its in the commments) was to map the personal folder in the logon script, instead of using the account profile setting, which is included for legacy compatability with windows nt/2000.

I did not implement that yet, but will likely do so in hte future.

Collapse -

Example here....Though a little different. It might help you..

Batch file to map network drives for users at logon.

Often it is asked how to create a batch frile to map network drives for users at logon. Here's how I did it at one site where I had a small number of users, but each user had a different set of mapped drives they needed to access.
Note, in this posting, ?sbs1? is the name of my SBS server. Substitue your SBS server name accordingly!
Location of script: The default SBS login script is located at c:\windows\sysvol\sysvol\sbs1\scripts and the script file is SBS_LOGIN_SCRIPT.bat.
Note: a quick way to get to this directory is to click Start > Run, and then enter \\sbs1\netlogon - and you will be right there, with no further drilling down any subdirectories!
1. First thing you want to do is to make a backup copy of the .bat file - just in case!
2. Next, edit the contents of the default .bat file so it looks like this, and then save it.

Rem Default SBS Login Script for users
\\sbs1\netlogon\%username%.BAT
3. I then created a new .bat file for each user. The name of the .bat file explicitly matched their actual logon name. So, if you logged on as JohnDoe, then the batch file was named JohnDoe.bat
Here is the content of one such user batch file:
Rem Batch File for user John Doe
NET USE Q: \\sbs1\Quickbooks
NET USE S: \\sbs1\SharedCompany
NET USE T: \\sbs1\Access
So, what happens is that when John Doe logs in, the default SBS script is started and immediately starts up the script file johndoe.bat, which has the various mapped drives to be declared.
4. Now, all you need to do is to create a new batch file for each user - no need to mess with the default SBS script any more. And no need to modify the name of the startup login script from within AD.
Add a new user? Simply add a new batch file!
Do not delete the default logon script.
It does more than just setup new computers, you add.
It also reapplies some sbs gpo's in case they have been altered, amongst other things. It also is used by the add software Wizard should you run it.

If you are going to be adding lines to the deafult logon script, I would highly recomend adding each line as a call statement, rather than just a line. other wise if you add 2 or more lines, there is the potential for some of them to not fire off. By using call you force the focus back to the defalut logon script after excecution of your new line.
So to use Kevin's example you would add

Call \\sbs1\netlogon\%username%.BAT

So your new default logon script would read

Rem Default SBS Login Script (First Line Always)
Call \\SBS1\Clients\Setup\setup.exe /s SBS1

Rem Default SBS Login Script for users
Call \\sbs1\netlogon\%username%.BAT

Rem Default SBS Login Script for Additional Command
Call \\SBS1\netlogon\AnotherBatchFile.bat

:End

This will ensure all the lines in your logon script get a chance to fire off.

http://msmvps.com/blogs/kwsupport/archive/2004/11/03/17830.aspx

Please post back if you have any more problems or questions.

Back to Hardware Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums