Execute
Save
Share
Share link
share
share
share
Team
Public Teams
Comments
0
Created By:
Guest
Title:
Network Resources
Title
Description
Edit
Copy Link
Login
Email *
Password *
Login
OR
Create Account
Screen Name *
Email *
Password *
Retype Password *
Team Access Code
Register
Public CodeBins
HELP
--Select Theme--
Ambiance
Blackboard
Cobalt
Eclipse
Elegant
Erlang-Dark
Lesser-Dark
Monokai
Neat
Night
Rubyblue
Vibrant-Ink
Xq-Dark
New CodeBin
CodeBins Versions
Network Resourc- V.3
Network Resourc- V.2
Network Resourc- V.1
Compare Versions
Recent CodeBins
View All CodeBins
< HTML > < HEAD > < TITLE > Configure Netwrok Resources < /title> <HTA:APPLICATION ICON="Setup.ico" ApplicationName="MapDrives.HTA" SingleInstance="Yes" WindowsState="Normal" Scroll="No" Navigable="No" MaximizeButton="No" SysMenu="No" Caption="Yes" ></HEAD > < SCRIPT LANGUAGE = "VBScript" > ' *** Define Drive Mappings *** dim arrDrives(2,2) intMaxdrives = 2 arrDrives(0,0) = "K:" arrDrives(0,1) = "server\share" arrDrives(0,2) = "Hand Up" arrDrives(1,0) = "J:" arrDrives(1,1) = "server\share" arrDrives(1,2) = "Hand Out" arrDrives(2,0) = "H:" arrDrives(2,1) = "server\share" arrDrives(2,2) = "Home Drive" ' * * * End Drive Map Definitions * * * strDOMAIN = "DOMAIN" 'Domain to prepend to the username Sub Window_Onload '#Size Window sHorizontal = 650 sVertical = 325 Window.resizeTo sHorizontal, sVertical '# Get Monitor Details Set objWMIService = GetObject _ ("winmgmts:rootcimv2") intHorizontal = sHorizontal *2 intVertical = sVertical *2 Set colItems = objWMIService.ExecQuery( _ "Select ScreenWidth, ScreenHeight from" _ & " Win32_DesktopMonitor", , 48) For Each objItem In colItems sWidth= objItem.ScreenWidth sHeight = objItem.ScreenHeight If sWidth > sHorizontal _ then intHorizontal = sWidth If sHeight > sVertical _ then intVertical = sHeight Next Set objWMIService = Nothing '#Center window on the screen intLeft = (intHorizontal - sHorizontal) / 2 intTop = (intVertical - sVertical) / 2 Window.moveTo intLeft, intTop '# default window content window.location.href="#Top" End Sub Sub RunScript on Error Resume Next minUSRnamelength = 2 minPASSwrdlength = 3 strUsr = UsrnameArea.Value strPas = PasswordArea.Value Set objNetwork = CreateObject("WScript.Network") Set oShell = CreateObject("Shell.Application") If Len(strUsr) >= minUSRnamelength then strUsr = strDOMAIN & UCase(strUsr) ' < ---adds the domain before the username if Len(strPas) >= minPASSwrdlength Then Call ClearDrives ' Delete existing mappings if they exist ' * * * * * Begin Drive mapping * * * * * For n = 0 To intMaxDrives 'Loop through our array of drives Err.Clear objNetwork.MapNetworkDrive arrDrives(n,0), arrDrives(n,1), False, strUsr, strPas If Err.Number = 0 Then oShell.NameSpace(arrDrives(n,0)).Self.Name = arrDrives(n,2) End If Next ' * * * * * End Drive Mapping * * * * * ELSE Msgbox chr(34) & strPas & "" " is an incorrect password !" Exit Sub End If ELSE Msgbox chr(34) & strUsr & "" " is an incorrect Username !" Exit Sub End If ' Clean up the objects before exiting Set oShell = Nothing Set objNetwork = Nothing Self.Close() End Sub Sub ClearDrives ' Sub Routine to remove the drives if they are already mapped On Error Resume Next Set objNetwork = CreateObject("WScript.Network") '***** Begin section to delete drive mappings *** Set AllDrives = objNetwork.EnumNetworkDrives For n = 0 To intMaxDrives ' Loop through our array of drives For i = 0 To AllDrives.Count - 1 Step 2 If AllDrives.Item(i) = arrDrives(n, 0) Then AlreadyConnected = True Next If AlreadyConnected = True then objNetwork.RemoveNetworkDrive arrDrives(n, 0), True, True End If Next '***** End section to delete drive mappings End Sub Sub DisconnectDrives ' Calls ClearDrives subroutine and then closes the window Call ClearDrives Set oShell = Nothing Set objNetwork = Nothing Self.close() End Sub Sub CancelScript Set oShell = Nothing Set objNetwork = Nothing Self.Close() End Sub < /SCRIPT> <style type="text/css "> .Font { color: #000; } </style> <BODY STYLE=" font: 14 pt arial; color: white; filter: progid: DXImageTransform.Microsoft.Gradient(GradientType = 1, StartColorStr = '#000000', EndColorStr = '#0000FF')"> <a name=" Top "></a><CENTER> <table border=" 0 " cellpadding=" 0 " cellspacing=" 0 "><font size=" 2 " color=" black " face=" Arial "> <tr> <td> <p align=" right "><img name=" " src=" logo.png " width=" 175 " height=" 163 " alt=" "></p> </td> <td><table width=" 350 " border=" 0 " cellpadding=" 0 "> <tr> <td colspan=" 2 " class=" Font "><div align=" center ">Mapping Year 09 Network Resources </div></td> </tr> <tr> <td colspan=" 2 " class=" Font "> </td> </tr> <tr> <td width=" 92 " class=" Font ">Username</td> <td width=" 252 " class=" Font "><input type=" text " name=" UsrnameArea " size=" 30 "></td> </tr> <tr> <td class=" Font ">Password</td> <td class=" Font "><input type=" password " name=" PasswordArea " size=" 30 "></td> </tr> <tr> <td class=" Font "><div align=" center "></div></td> <td class=" button - success pure - button "><input id=runbutton2 class=" button " type=" button " value=" Map Drives " name=" run_button " onClick=" RunScript "> <input id=runbutton class=" button " type=" button " value=" Cancel " name=" cancel_button " onClick=" CancelScript "></td> </tr> </table></td></tr> </table><BR> <HR color=" #0000FF"> <HR color= "#0000FF" > < span class = "Font" > If for some reason this doesn 't map the Hand Up & Hand Out network drives<br> please contact the IT Support Office </span> </CENTER> </BODY>
Bottom of Page
In Head
On Load
On Ready
Setting
Validate
Copy
Format
Setting
Validate
Copy
Format
No Doc Type
HTML5
HTML 4.01 Transitional
HTML 4.01 Strict
HTML 4.01 Frameset
XHTML 1.1
XHTML 1.0 Transitional
XHTML 1.0 Strict
XHTML 1.0 Frameset
Copy
Format
Download
×
Code Description
×
Difference of Versions
HTML
CSS
JS
×
JS Error
×
CSS Error
Errors
Warnings
×
JavaScript Setting
JS Libraries:
Chrome Frame 1.0.3
Dojo 1.8.0
Dojo 1.7.3
Dojo 1.7.2
Ext Core 3.1.0
jQuery 1.8.0
jQuery 1.7.2
jQuery 1.6.0
jQuery 1.5.0
jQuery 1.4.4
jQuery 1.4.0
jQuery-min 1.7.2
jQueryUI-min 1.8.21
MooTools more-1.4.0.1-full
MooTools core-1.4.5-full
MooTools core-1.4.1-full
Prototype 1.7.1.0
script.aculo.us 1.9.0
SWFObject 2.2
Twitter Bootstrap 2.0.4
WebFont Loader 1.0.28
yui 3.5.1
User Libraries:
Upload File
JavaScript URL(s):
×
CSS Setting
CSS Libraries:
jQueryUI 1.8.21
Twitter Bootstrap 2.0.4
User Libraries:
Upload File
CSS URL(s):