Error when trying to map a drive in a log on vb script

Hi, I have a vb script log on script which I am calling from Group Policy and running on Vista Clients.  I get the following error when trying to map a network drive in the script:

"The specified network resource or device is no longer available."

Please see attached code... your help would be appreciated, thanks
If (IsMember("STUDENTS") = TRUE) Then
	strUNCPath = "\\server1\students$\" & strUserName
	Wscript.echo "You are logged in with a Student account"
	strUNCPath = "\\server2\STAFF$\" & strUserName
	Wscript.echo "You are logged in with a Staff account"
End If
Sub subMappingRoutine
objNetwork.MapNetworkDrive strDriveLetter, strUNCPath
End Sub

Open in new window

Who is Participating?
WylkellConnect With a Mentor Commented:
so that means either you have a permissions issue or there really isn't a path that equals whatever ' "\\server1\students$\" & strUserName' is.  If you log in as a student and attempt to map a drive to that location, it should give you the same error.  Without knowing the setup of your network, i'd have to guess it's either permissions or something to do with \\server1\students$\" & strUserName not being a valid UNC link (ie, the path is wrong).

If you have a test student account you should be able to simulate this and figure out where everything is failing.  I'd start by giving the test account full admin rights on the box with those shares on it and see if that helps.  if it doesn't, log into the box and try to map the drive by hand.
can the accounts your running that logon script against access those hidden shares on thier own?  That isn't a vbscript error, that's a windows error.  You'd get the same error if you tried a net use command instead of using WSH/VBS.
PURIM-EAuthor Commented:
OK... so how do I map the network drive (home area) in a script ?  The script works fine when I log on with a staff account (ELSE statement) but not if I log on as a student account.
PURIM-EAuthor Commented:
Thanks... you were right - I was missing a directory off the path
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.