I have a script I wrote that gets a users name and password and maps a network drive for them. It is all working except I can't get it to actually open up the share. Here is the code for my last attempt. I know this should be easy but I can't figure it out.
P.S (Everything up to and including the msgbox works.)
Set objNetwork = WScript.CreateObject("WScript.Network")
strPer = "FALSE"
strUsr = InputBox("Please Enter Your Username")
strPas = Enter your Password")
strLocalDrive = "h:"
strRemoteShare = "\\macx\user\" &strUsr
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, strPer, strUsr, strPas
mDrive = "h:"
Set oShell = CreateObject("Shell.Application")
oShell.NameSpace(mDrive).Self.Name = strUsr & " on macx"
MsgBox "You have successfully mapped to your H: drive! Go forth, and be a better human
being."
Option Explicit
Const vbNormalFocus = 1
Const path = "\\macx\" & strUsr
WScript.CreateObject("WScriptShell").Run
"explorer.exe \n,\root,""" & path
P.S (Everything up to and including the msgbox works.)
Set objNetwork = WScript.CreateObject("WScript.Network")
strPer = "FALSE"
strUsr = InputBox("Please Enter Your Username")
strPas = Enter your Password")
strLocalDrive = "h:"
strRemoteShare = "\\macx\user\" &strUsr
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, strPer, strUsr, strPas
mDrive = "h:"
Set oShell = CreateObject("Shell.Application")
oShell.NameSpace(mDrive).Self.Name = strUsr & " on macx"
MsgBox "You have successfully mapped to your H: drive! Go forth, and be a better human
being."
Option Explicit
Const vbNormalFocus = 1
Const path = "\\macx\" & strUsr
WScript.CreateObject("WScriptShell").Run
"explorer.exe \n,\root,""" & path