Link to home
Start Free TrialLog in
Avatar of mickeyshelley1
mickeyshelley1Flag for United States of America

asked on

I need help mapping a network drive in Group Policy.

Hi,
I am having a problem making this vbs file work in group policy. Basically I am trying to get a certain network drive to map to selected users when they log in. I have placed this in group policy, but i guess that I am not doing it correctly or either the file is bad. The vbs file works fine if I run it manually. Below is the file. Please help, I am at a dead end.

Thanks:

 
Option Explicit
Dim objNetwork
Dim strDriveLetter, strRemotePath
strDriveLetter = "p:"
strRemotePath = "\\w2kabb1\Database"

' Purpose of script to create a network object. (objNetwork)
' Then to apply the MapNetworkDrive method.  Result h: drive
Set objNetwork = CreateObject("WScript.Network")

objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
WScript.Quit


ASKER CERTIFIED SOLUTION
Avatar of Bird Dog
Bird Dog
Flag of Canada image

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
once the vbs is done attach to the user side of the gpo and then attach to an ou.
sorry add the following before dim line
ON ERROR RESUME Next

Avatar of mickeyshelley1

ASKER

The code works. Can you tell me where I am going wrong in applying it to Group Policy. Shouldn't it be as simple as it running when certain users log on.
Example of Groups:

Admin
-power users
  - Users

I have the Group Policy located in the Users folder. Shouldn't that make it to where that policy would apply to the Users only. It is also in the Windows settings/logon in the properties settings.
Avatar of Kevin Hays
Are your users residing in the OU you have your GPO linked to?  Are you using GPMC?  Under the User section/windows settings/scripts/login click on show files, is your script located in there?  If not then paste it in there.  You might need to run gpupdate /force on the client machine.

Also make sure authenticated users have "read and apply group policy " enabled in the security settings.

That's all you need for it to work.
so you set this under user config - windows settings - Scripts - logon.
Once complete you attach to an ou where you moved the group of users
am I right so far?
If you have the group policy located on the users container then that is your problem.  The users container is a "container" not an organization unit.  You cannot apply gpo's here.

Create a OU and then link it to that OU, then move your users inside the OU.