Welcome, Register for free! or Login below:
EduGeek.net RSS Feeds Register FAQ Members Social Groups User Map Calendar Search Today's Posts Mark Forums Read

Scripts If you need or have any scripts then get 'em here.

Go Back   EduGeek.net Forums > Coding and Web Development > Scripts
Reply
 
LinkBack Thread Tools Search Thread
Sponsored Links
Old 07-01-2009, 04:32 PM   #1
 
mcheung0's Avatar
 
Join Date: Sep 2008
Location: York
Posts: 8
uk uk yorkshire
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0 mcheung0 is an unknown quantity at this point
Default A bewildering logon/logoff VBscript error problem

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.
????: EduGeek.net Forums http://www.edugeek.net/forums/scripts/28639-bewildering-logon-logoff-vbscript-error-problem.html
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
  Reply With Quote
Old 07-01-2009, 04:36 PM   #2
 
powdarrmonkey's Avatar
 
Join Date: Feb 2008
Location: Alcester, Warwickshire
Posts: 2,581
uk
Thanks: 136
Thanked 305 Times in 261 Posts
Rep Power: 66 powdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant futurepowdarrmonkey has a brilliant future
Default

Is the users home drive set to G, by any chance? because Windows will map and unmap that for you.

Last edited by powdarrmonkey; 07-01-2009 at 04:36 PM.. Reason: speeling
  Reply With Quote
Old 07-01-2009, 04:37 PM   #3
 
jamesb's Avatar
 
Join Date: Mar 2008
Location: Bedford
Posts: 862
uk uk england
Thanks: 13
Thanked 105 Times in 93 Posts
Rep Power: 24 jamesb is a name known to alljamesb is a name known to alljamesb is a name known to alljamesb is a name known to alljamesb is a name known to alljamesb is a name known to all
Send a message via MSN to jamesb
Default

What's the actual code you're using?
  Reply With Quote
Old 07-01-2009, 04:46 PM   #4
 
mcheung0's Avatar
 
Join Date: Sep 2008
Location: York
Posts: 8
uk uk yorkshire
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0 mcheung0 is an unknown quantity at this point
Default Code

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
  Reply With Quote
Old 07-01-2009, 04:48 PM   #5
 
jamesb's Avatar
 
Join Date: Mar 2008
Location: Bedford
Posts: 862
uk uk england
Thanks: 13
Thanked 105 Times in 93 Posts
Rep Power: 24 jamesb is a name known to alljamesb is a name known to alljamesb is a name known to alljamesb is a name known to alljamesb is a name known to alljamesb is a name known to all
Send a message via MSN to jamesb
Default

Do the other two drives map successfully when running it from the server?
  Reply With Quote
Old 07-01-2009, 04:49 PM   #6
 
mcheung0's Avatar
 
Join Date: Sep 2008
Location: York
Posts: 8
uk uk yorkshire
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0 mcheung0 is an unknown quantity at this point
Default

Yes they throw no errors
  Reply With Quote
Old 07-01-2009, 04:52 PM   #7
 
srochford's Avatar
 
Join Date: Aug 2005
Location: London
Posts: 1,698
uk
Thanks: 9
Thanked 200 Times in 178 Posts
Blog Entries: 1
Rep Power: 47 srochford has much to be proud ofsrochford has much to be proud ofsrochford has much to be proud ofsrochford has much to be proud ofsrochford has much to be proud ofsrochford has much to be proud ofsrochford has much to be proud ofsrochford has much to be proud of
Default

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)
Code:
MapNetworkDrive "G:", "\\server\share"
when you want to map and
Code:
UnMapNetworkDrive "G:"
when you want to unmap.

Code:
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
  Reply With Quote
Old 07-01-2009, 04:58 PM   #8
 
jamesb's Avatar
 
Join Date: Mar 2008
Location: Bedford
Posts: 862
uk uk england
Thanks: 13
Thanked 105 Times in 93 Posts
Rep Power: 24 jamesb is a name known to alljamesb is a name known to alljamesb is a name known to alljamesb is a name known to alljamesb is a name known to alljamesb is a name known to all
Send a message via MSN to jamesb
Default

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:?
  Reply With Quote
Old 07-01-2009, 05:35 PM   #9
 
FN-GM's Avatar
 
Join Date: Jun 2007
Location: Rochdale, Lancashire
Posts: 6,619
uk uk england
Thanks: 189
Thanked 355 Times in 323 Posts
Rep Power: 77 FN-GM has a brilliant futureFN-GM has a brilliant futureFN-GM has a brilliant futureFN-GM has a brilliant futureFN-GM has a brilliant futureFN-GM has a brilliant futureFN-GM has a brilliant futureFN-GM has a brilliant futureFN-GM has a brilliant futureFN-GM has a brilliant futureFN-GM has a brilliant future
Send a message via Skype™ to FN-GM
Default

Does the share still exist? What about security permissions?
  Reply With Quote
Old 08-01-2009, 11:27 AM   #10
 
mcheung0's Avatar
 
Join Date: Sep 2008
Location: York
Posts: 8
uk uk yorkshire
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0 mcheung0 is an unknown quantity at this point
Default Success!

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
  Reply With Quote
Reply
Similar Threads
Thread Thread Starter Forum Replies Last Post
VBScript Error sqdge Scripts 20 13-09-2007 03:34 PM
Application error at logoff - real headache woody Windows 6 03-01-2007 09:51 AM
Application error at logoff - real headache woody Windows 3 07-12-2006 07:20 PM
Application error at logoff - real headache woody Windows 0 07-12-2006 12:27 PM
Application error at logoff - real headache woody Windows 0 07-12-2006 12:27 PM


Tags
error, logoff, logon, script


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search Thread
Search Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:43 PM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 ©2009, Crawlability, Inc.
Copyright EduGeek.net




website uptime

© 2005 - 2009 EduGeek.net
no new posts