Link to home
Start Free TrialLog in
Avatar of PURIM-E
PURIM-E

asked on

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
	subMappingRoutine
	Wscript.echo "You are logged in with a Student account"
Else
 
	strUNCPath = "\\server2\STAFF$\" & strUserName
	subMappingRoutine
	Wscript.echo "You are logged in with a Staff account"
End If
 
Sub subMappingRoutine
objNetwork.MapNetworkDrive strDriveLetter, strUNCPath
End Sub

Open in new window

Avatar of Wylkell
Wylkell

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.
Avatar of PURIM-E

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Wylkell
Wylkell

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PURIM-E

ASKER

Thanks... you were right - I was missing a directory off the path