Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Microsoft Support > Windows NT/2000/2003 Server/2008 Server
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Windows NT/2000/2003 Server/2008 Server Find support for Windows NT/2000/2003 Server/2008 Server editions.

Reply
 
LinkBack Thread Tools
Old 05-20-2009, 05:05 PM   #1 (permalink)
Registered User
 
Join Date: May 2009
Posts: 4
OS: Windows 2003 Server


[SOLVED] vbs login script

Hey, I don't have much experience with vbs so I'm looking for a bit of help!
This is the script that I'm currently running:

--------
ON ERROR RESUME NEXT
DIM objNetwork,colDrives,i
SET objNetwork = CREATEOBJECT("Wscript.Network")
SET colDrives = objNetwork.EnumNetworkDrives
FOR i = 0 to colDrives.Count-1 Step 2
' Force Removal of network drive and remove from user profile
' objNetwork.RemoveNetworkDrive strName, [bForce], [bUpdateProfile]
objNetwork.RemoveNetworkDrive colDrives.Item(i),TRUE,TRUE
NEXT

Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "G:" , "\\servername\sharename1"
objNetwork.MapNetworkDrive "S:" , "\\servername\sharename2"
objNetwork.MapNetworkDrive "T:" , "\\servername\sharename3"

---------

Currently this script removes all network drives, then maps g,s and t.I want to change this script so that it overrides existing drives with the same letter (g,s,t) but leaves all other drives that the client may have mapped themselves intact. (ex. usershare to a different server).

Any help would be greatly appreciated.

Thanks,

Chris
asmoa is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 05-21-2009, 04:17 PM   #2 (permalink)
TSF Enthusiast
 
TheOutcaste's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 821
OS: MS-Dos 6.22 - Win7


Re: vbs login script

This should do it:
Code:
ON ERROR RESUME NEXT
DIM objNetwork
SET objNetwork = CREATEOBJECT("Wscript.Network")

' objNetwork.RemoveNetworkDrive strName, [bForce], [bUpdateProfile]
objNetwork.RemoveNetworkDrive "G:",TRUE,TRUE
objNetwork.RemoveNetworkDrive "S:",TRUE,TRUE
objNetwork.RemoveNetworkDrive "T:",TRUE,TRUE

objNetwork.MapNetworkDrive "G:" , "\\servername\sharename1"
objNetwork.MapNetworkDrive "S:" , "\\servername\sharename2"
objNetwork.MapNetworkDrive "T:" , "\\servername\sharename3"
HTH

Jerry
__________________
Microsoft MVP - Windows Desktop Experience
Of course I know all the answers; I just don't always match the answers to the right questions.
Rated R for Violence -- When your PC flies through a window, that's violent, right?
TheOutcaste is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-22-2009, 11:06 AM   #3 (permalink)
Registered User
 
Join Date: May 2009
Posts: 4
OS: Windows 2003 Server


Re: vbs login script

Thanks for the reply Jerry.

This script seems like it would work, but if i have T mapped to t:\servername\d and run this script it wont remove the existing map and remap it to \\servername\sharename3

If no mapping initially existing for T, then it works great and maps t to \\servername\sharename3 like it should.

It doesn't seem to want to remove existing drive mappings.

Hope that makes sense.

Chris

Last edited by asmoa; 05-22-2009 at 11:08 AM.
asmoa is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-22-2009, 11:25 AM   #4 (permalink)
Registered User
 
Join Date: May 2009
Posts: 4
OS: Windows 2003 Server


Re: vbs login script

I ended up getting it to work by adding "wscript.sleep 300"

--------------------

ON ERROR RESUME NEXT
DIM objNetwork
SET objNetwork = CREATEOBJECT("Wscript.Network")

' objNetwork.RemoveNetworkDrive strName, [bForce], [bUpdateProfile]
objNetwork.RemoveNetworkDrive "G:",TRUE,TRUE
objNetwork.RemoveNetworkDrive "S:",TRUE,TRUE
objNetwork.RemoveNetworkDrive "T:",TRUE,TRUE

wscript.sleep 300

objNetwork.MapNetworkDrive "G:" , "\\servername\sharename1"
objNetwork.MapNetworkDrive "S:" , "\\servername\sharename2"
objNetwork.MapNetworkDrive "T:" , "\\servername\sharename3"

---------------------
asmoa is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-22-2009, 06:05 PM   #5 (permalink)
TSF Enthusiast
 
TheOutcaste's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 821
OS: MS-Dos 6.22 - Win7


Re: vbs login script

Glad you figured it out. I tested by only removing one mapped drive so didn't run into the need for a delay to let the system catch up. I should have thought of that.

If your issue is resolved you can mark this thread Solved using the Thread Tools at the top of the thread on the right side.

Jerry
__________________
Microsoft MVP - Windows Desktop Experience
Of course I know all the answers; I just don't always match the answers to the right questions.
Rated R for Violence -- When your PC flies through a window, that's violent, right?
TheOutcaste is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 01:22 AM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85