I need a VB Script to Map a Drive have a look at the last post
30 laptops, shared between Year 1 and Year 2 classes (Infant School)
Laptops not on a domain - a project for another time.
When the laptop is switched on it logs straight into a standard pupil user profile and Maps the root of the Children's shared drive (NAS).
This all works fine and the laptops are pretty stable. The only concern at the moment is the children are struggling to carefully navigate to their Class folder, then into a 'topic' folder... e.g.
The sometimes end up 'accidentally' moving an entire folder into another one, which is hilarious the first time it happens, but then it gets a little tiring - The Mystery of the Missing Folder.
I thought of creating a BATCH file at logon to prompt for the class they belong to, and map that particular shared folder...
It would be nicer as a GUI if anyone has done something like this before (like RM Class Selector)
Your thoughts/help would be much appreciated.
mrwoberts (1st February 2014)
Thanks sted, I like command line scripts.
I've been trawling the net and adapted a solution I found here.
Created a new text file with name MapHomeDrive.HTA
Code:<HTML> <HEAD> <TITLE>Map drive M: to Class Folder</title> <HTA:APPLICATION ApplicationName="MapClassFolder.HTA" SingleInstance="Yes" WindowsState="Normal" Scroll="No" Navigable="No" MaximizeButton="No" SysMenu="No" Caption="No" ></HEAD> <SCRIPT LANGUAGE="VBScript"> Option Explicit Dim objNetwork, objShell Dim strMapDriveLetter, strMapDrivePath, bPersistent Set objNetwork = CreateObject("WScript.Network") Set objShell = CreateObject("Shell.Application") strMapDriveLetter = "M:" bPersistent = False Sub Window_onLoad window.resizeTo 400, 175 window.moveTo 400, 300 End Sub Sub MapDrive(strClassName) on Error Resume Next 'Create full path using Class name strMapDrivePath = "\\NAS\" & strClassName 'Disconnect current M drive Call DisconnectDrive() 'Map drive and alias objNetwork.MapNetworkDrive strMapDriveLetter, strMapDrivePath, bPersistent objShell.NameSpace(strMapDriveLetter).Self.Name = "Home" CloseScript() End Sub Sub CloseScript Set objShell = Nothing Set objNetwork = Nothing Self.Close() End Sub Sub DisconnectDrive on Error Resume Next objNetwork.RemoveNetworkDrive strMapDriveLetter, True, True End Sub </SCRIPT> <BODY STYLE="font:14 pt arial;"> <CENTER>Choose your Class <HR color="#0000FF"> <Input type="button" value=" Apple " onClick="MapDrive('Apple')"> <Input type="button" value=" Banana " onClick="MapDrive('Banana')"> <Input type="button" value=" Pear " onClick="MapDrive('Pear')"> <HR color="#0000FF"> <Input type="button" value=" Disconnect " onClick="DisconnectDrive"> <Input type="button" value=" Close " onClick="CloseScript"> </CENTER> </BODY> </HTML>
IWDave (3rd February 2014)
There are currently 1 users browsing this thread. (0 members and 1 guests)