rubbersoul
IS-IT--Management
What I need to do is write a script that will pop up a box prompting for a username password and domain....once there it'll take those values and use them in the rest of the script to map a drive to the local machine.
I've connected to my network using a VPN client and can ping everything....however I need to authenticate in order to map drives.....this is what I have so far and it's not working. The index.htm pops up and I put in my username, password and domain....but then it errors out when it trys to run the rest of the script....help please
Dim strUserName
Dim strPassword
Dim strDomain
Set objExplorer = WScript.CreateObject _
("InternetExplorer.Application", "IE_")
objExplorer.Navigate "file:///c:\scripts\index.htm"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 400
objExplorer.Height = 250
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1
Do While (objExplorer.Document.All.OKClicked.Value = "")
Wscript.Sleep 250
Loop
strUserName = objExplorer.Document.All.UserBox.Value
strPassword = objExplorer.Document.All.PasswordBox.Value
strDomain = objExplorer.Document.All.DomainBox.Value
objExplorer.Quit
Wscript.Sleep 250
Dim WSHNetwork
Dim FSO
Dim ObjGroupDict
Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set strUserName = WScript.CreateObject("WScript.UserName")
'Set strPassword = WScript.CreateObject("WScript.Network")
Set strDomain = WScript.CreateObject("WScript.UserDomain")
'
' Wait until the user is really logged in...
'
strUserName = ""
While strUserName = ""
WScript.Sleep 100 ' 1/10 th of a second
strUserName = WSHNetwork.UserName
Wend
strDomain = WSHNetwork.UserDomain
' Map F: drive to their home folder
WshNetwork.RemoveNetworkDrive "F:"
WScript.Sleep 100 ' 1/10 th of a second
WSHNetwork.MapNetworkDrive "F:", "\\YULSP545\" & WSHNetwork.UserName & "$"
I've connected to my network using a VPN client and can ping everything....however I need to authenticate in order to map drives.....this is what I have so far and it's not working. The index.htm pops up and I put in my username, password and domain....but then it errors out when it trys to run the rest of the script....help please
Dim strUserName
Dim strPassword
Dim strDomain
Set objExplorer = WScript.CreateObject _
("InternetExplorer.Application", "IE_")
objExplorer.Navigate "file:///c:\scripts\index.htm"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 400
objExplorer.Height = 250
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1
Do While (objExplorer.Document.All.OKClicked.Value = "")
Wscript.Sleep 250
Loop
strUserName = objExplorer.Document.All.UserBox.Value
strPassword = objExplorer.Document.All.PasswordBox.Value
strDomain = objExplorer.Document.All.DomainBox.Value
objExplorer.Quit
Wscript.Sleep 250
Dim WSHNetwork
Dim FSO
Dim ObjGroupDict
Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set strUserName = WScript.CreateObject("WScript.UserName")
'Set strPassword = WScript.CreateObject("WScript.Network")
Set strDomain = WScript.CreateObject("WScript.UserDomain")
'
' Wait until the user is really logged in...
'
strUserName = ""
While strUserName = ""
WScript.Sleep 100 ' 1/10 th of a second
strUserName = WSHNetwork.UserName
Wend
strDomain = WSHNetwork.UserDomain
' Map F: drive to their home folder
WshNetwork.RemoveNetworkDrive "F:"
WScript.Sleep 100 ' 1/10 th of a second
WSHNetwork.MapNetworkDrive "F:", "\\YULSP545\" & WSHNetwork.UserName & "$"