troubleshooting Question

Script for disconnecting mapped drive, map home drive and another drive. If possible run group policy through script

Avatar of tshobe
tshobe asked on
PerlWindows BatchVB Script
18 Comments1 Solution556 ViewsLast Modified:
I am new to VB Scripting.  Here is a little background.  I have around 100 laptops that won't do a prelogon to authenticate against the domain.  I am left to a local account on a machine and mapping network drives and hopefully the group policy.  My main goal is to map drives.  Here is what I am trying to accomplish.
1.  Disconnect drives in steps 3 and 4 if they exist. If not then.
2.  prompt for domain user name and password.
3.  map home drive for said username
4.  map second drive for users
5.  If this is possible pull down the group policy.

I have gotten bits and pieces from other sites to do 2, 3, and 4 somewhat, but am struggling with step 1.  Here is what I have so far.
   ' Volume to remove
  strDrive = "Y:"
  Set objNet = CreateObject("")
  objNet.RemoveNetworkDrive "Y:", True, True

  ' Volume to remove
  strDrive = "Z:"
  Set objNet = CreateObject("")
  objNet.RemoveNetworkDrive "Z:", True, True

  End If

Set network = WScript.CreateObject("WScript.Network")
uName = InputBox("Please enter you User Name")
uName = uName
pWord = InputBox("Please enter you Password")
homeDrive = "\\SERVER\shares\Student\users\" & uName

network.MapNetworkDrive "Y:", homeDrive,True,uName,pWord

Dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
strLocalDrive = "Z:"
strRemoteShare = "\\server\shares\student\public"
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, strPer, strUsr, strPas

End If

Thank you for any help in advance.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 18 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros