Tech Support Forum banner

Trouble with VBScript for network drives...

1295 Views 0 Replies 1 Participant Last post by  ralfs_k
the idea is to create simple vbs for mapping network drives for windows xp under password, and so noone can simply open vbs file in notepad to see password will convert vbs > exe... the script is something like this
Set objNetwork = CreateObject("WScript.Network")
Dim Ask
Ask = inputBox("user:")
strUser = "test"
If Ask = strUser Then
set Ask = nothing
Ask = inputBox("password:")
strPassword = "test"
if Ask = strPassword then
set ask = nothing
end if
elseif MsgBox("error") Then
location.reload(true)
end If
strDriveLetter = "x:"
strRemotePath = "\\192.168.1.1\tests"
strProfile = "False" ' means do not store in profile leave as false.
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath, strProfile, strUser, strPassword
Call ShowExplorer
Sub ShowExplorer()
Set objShell = CreateObject("WScript.Shell")
objShell.run ("Explorer" & " " & strDriveLetter & "\" )
End Sub
as you can see in the script at the end if user/pass is entered correctly mapped drive window is opened... now i want to know is it possible somehow to monitor if that windows is closed? idea is to make netdrive disconnect as soon as called explorer window is closed!

if this script is big load of dog crap i'l understand cuz today is my first day experience with vbs :sigh:
Status
Not open for further replies.
1 - 1 of 1 Posts
1 - 1 of 1 Posts
Status
Not open for further replies.
Top