mcheung0 Posted January 7, 2009 Posted January 7, 2009 We are becoming more and more confused by this little problem: We have a logon script to map drives and logoff script to remove them. These are implemented by the user on Server 2003. On logon all users encounter the script error: "Local device name already in use" Code: 8007055 Source: WSHNetwork.MapNetworkDrive The line and character references point to a "G:" drive. On logoff all users encounter the script error: "Network connection doesn't exist" Code: 800708CA Source: WSHNetwork.RemoveNetworkDrive Again the line and character references point to the "G:" drive. Therefore, users are unable to disconnect from the "G:" drive as it apparently does not exist (which is does as it is visible) but adversely are unable to connect at logon as it "already exists". Peculiar no? When executing the scripts locally on a computer they run correctly so could it be a server problem? Thanks Michael
powdarrmonkey Posted January 7, 2009 Posted January 7, 2009 (edited) Is the users home drive set to G, by any chance? because Windows will map and unmap that for you. Edited January 7, 2009 by powdarrmonkey speeling
mcheung0 Posted January 7, 2009 Author Posted January 7, 2009 Powdarrmonkey: no it's not the home folder - thanks anyway Jamesb: here is the logon script: Option Explicit Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3 Dim strDriveLetter1, strDriveLetter2, strDriveLetter3 dim strMessage dim WshNetwork Dim strUNCPrinter1, strUNCPrinter2, strUNCPrinter3 strDriveLetter1 = "G:" strDriveLetter2 = "S:" strDriveLetter3 = "T:" strRemotePath1 = "\\hades\VCD Files" strRemotePath2 = "\\artemis\sims" strRemotePath3 = "\\prometheus\tregelles\shared teaching data" Set objNetwork = CreateObject("WScript.Network") ' Section which maps drives, G:, S:, & T: objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1 objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2 objNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3 ____________________________________________________ The error points to "objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1" here is the logoff script: Option Explicit ' Defines variables Dim objNetwork, strDriveLetter1, strDriveLetter2, strDriveLetter3 Dim objWMIService Dim objPrinter Dim strComputer Dim strPrinter Dim colInstalledPrinters ' Inializes variables with drive letters strDriveLetter1 = "G:" strDriveLetter2 = "S:" strDriveLetter3 = "T:" Set objNetwork = CreateObject("WScript.Network") ' Section which removes strDriveLetter objNetwork.RemoveNetworkDrive strDriveLetter1 objNetwork.RemoveNetworkDrive strDriveLetter2 objNetwork.RemoveNetworkDrive strDriveLetter3 ________________________________________ The error points to "objNetwork.RemoveNetworkDrive strDriveLetter1" As I say, when running the scripts manually they run correctly Thanks Michael
jamesb Posted January 7, 2009 Posted January 7, 2009 Do the other two drives map successfully when running it from the server?
srochford Posted January 7, 2009 Posted January 7, 2009 In the past, I've used functions like the ones below to handle drive mapping/unmapping. they make sure the drive letter is not in use before attempting to map and force a disconnect. the unmap checks to make sure the connection is there before trying to unmap. You can just call (eg) MapNetworkDrive "G:", "\\server\share" when you want to map and UnMapNetworkDrive "G:" when you want to unmap. Sub MapNetworkDrive(sDrive,sShare) sDrive=ucase(sDrive) Set clDrives = oNetwork.EnumNetworkDrives For i = 0 to clDrives.Count -1 step 2 if ucase(clDrives.Item(i))=sDrive then oNetwork.removenetworkdrive sDrive,true,true 'force and update profile exit for end if next oNetwork.mapnetworkdrive sDrive,sShare,false 'don't update profile end sub Sub UnMapNetworkDrive(sDrive) sDrive=ucase(sDrive) Set clDrives = oNetwork.EnumNetworkDrives For i = 0 to clDrives.Count -1 step 2 if ucase(clDrives.Item(i))=sDrive then oNetwork.removenetworkdrive sDrive,true,true 'force and update profile exit for end if next end sub
jamesb Posted January 7, 2009 Posted January 7, 2009 Just out of curiousity, do the computers have card readers? What happens if you try changing the G: to a later drive letter, say N:?
FN-GM Posted January 7, 2009 Posted January 7, 2009 Does the share still exist? What about security permissions?
mcheung0 Posted January 8, 2009 Author Posted January 8, 2009 Thanks for all your responses - we're very grateful. In the end it was a simple solution - we had two sets of logon/logoff scripts. Therefore the first set mapped/removed all the drives correctly and then the second set attempted to map/remove once again causing the errors. The second set has been removed and now we are error free - hurrah! Michael
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now