If a drive is already mapped, then open Windows Explorer
- From: sebrezina@xxxxxxxxxxxxxx
- Date: 21 Mar 2007 08:25:41 -0700
I'm a newbie to VBScripting, so hopefully this will make sense. We
have users that will be connecting to a Terminal Server in order to
map a network drive to a share that exists in a different domain then
they are already authenicated to. The Terminal server is really
locked down, so they can't even open Windows Explorer and select "Map
Network Drive" and "Log on as different user". I wrote a script that
will automatically set the domain name and then prompt the user for a
username and password. After the user authenticates, the script will
open Windows Explorer to the drive they mapped. This part is working
exactly as I want. The problem is I want to be able to see if the
drive is already mapped, and if so, open Windows Explorer. If not, it
would then go ahead and prompt the user for username and password. I
started messing around with If Then Else statements, but so far no
luck. Any suggestions would be greatly appreciated. Thanks!!!
strRemoteDomain = "Remote Domain Name"
Set objNetwork = Wscript.CreateObject ("Wscript.Network")
strUserName = InputBox("Please Enter Your UserName:", "UserName
prompt")
strRemoteUserName = strRemoteDomain & "\" & strUserName
strPassword = InputBox("Please Enter Your Password:", "Password
prompt", "<password>")
objNetwork.MapNetworkDrive "M:", "\\Server\Share", FALSE,
strUserName, strPassword
Set objExplorer = WScript.CreateObject("InternetExplorer.Application")
objExplorer.Navigate "M:"
objExplorer.ToolBar = 1
objExplorer.StatusBar = 1
objExplorer.Width=800
objExplorer.Height = 600
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1
wscript.quit
.
- Prev by Date: Pulling info out of a text log file and manipulating it
- Next by Date: Re: IE 7 Script bSecurity
- Previous by thread: Pulling info out of a text log file and manipulating it
- Next by thread: Re: Join Windows 2000 computer to domain
- Index(es):
Relevant Pages
|