troubleshooting Question

Logon scripts .vbs - remove pop up window

Avatar of seaweed27
seaweed27 asked on
Windows Server 2003Server HardwareActive Directory
5 Comments1 Solution694 ViewsLast Modified:
When this script executes, a window pops up which requires a user to click "ok". I would prefer it execute without promting the user to click "ok",or even notifying the user.  Is this possible, if so how would i accomplish the task.
tia
seaweed27
' Already.vbs Windows Logon Script
' VBScript to map a network drive.
' Author Guy Thomas http://computerperformance.co.uk/
' Version 1.7 - April 24th 2005
' ------------------------------------------------------' 
Option Explicit
Dim strDriveLetter, strRemotePath
Dim objNetwork, objShell
Dim CheckDrive, AlreadyConnected, intDrive 
' The section sets the variables. 
strDriveLetter = "L:" 
strRemotePath = "\\server\share" 
 
' This sections creates two objects:
' objShell and objNetwork and counts the drives
Set objShell = CreateObject("WScript.Shell") 
Set objNetwork = CreateObject("WScript.Network") 
Set CheckDrive = objNetwork.EnumNetworkDrives() 
 
' This section deals with a For ... Next loop
' See how it compares the enumerated drive letters
' with strDriveLetter
On Error Resume Next
AlreadyConnected = False 
For intDrive = 0 To CheckDrive.Count - 1 Step 2 
If CheckDrive.Item(intDrive) =strDriveLetter _
Then AlreadyConnected =True
Next 
 
' This section uses the If = then, else logic
' This tests to see if the Drive is already mapped.
' If yes then disconnects
If AlreadyConnected = True then 
objNetwork.RemoveNetworkDrive strDriveLetter 
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath 
 
' The first message box
objShell.PopUp "Drive " & strDriveLetter & _
"Disconnected, then connected successfully." 
Else
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath 
objShell.PopUp "Drive " & strDriveLetter & _
" connected successfully." End if 
WScript.Quit 
 
' Guy's Script ends here
ASKER CERTIFIED SOLUTION
exx1976

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros