GPO or script, both solutions work everything depends what you prefer. The drive mapping is now subject to condition (if). IsMember = CBool(groupListD.Exists(groupName))ĮnvString = oShell.ExpandEnvironmentStrings(variable)Īs you can see, we added two functions at the end of the code, which allow verification of the group membership of the connected user. Set userPath = GetObject("WinNT://" & ADSPath & ",user") Set groupListD = CreateObject("Scripting.Dictionary")ĪDSPath = EnvString("userdomain") & "/" & EnvString("username") Set oShell = CreateObject("WScript.Shell") Edit the file: 'En cas d erreur le script continue How for the GPO, we will now modify the script to limit the network drive mapping to Grp_partage_RW group.ġ. Add the script to Group Policy logon to map the network drive. WshNetwork.MapNetworkDrive "P:", "\\LAB-AD1\partage", trueģ. Set WshNetwork = WScript.CreateObject("WScript.Network") Edit the file (Notepad ++, notepad …) and add the codes below: ' En cas d erreur le script continue Create a new file that should have the vbs extension.Ģ. If you go back to the overview of the parameters of the strategy, you can see the elements of the targeting 1.ġ. It’s over, the P drive will be mapped only to users in the Grp_Partage_RW group. Click New Item 1 and select Security Group 2.ĥ. Go to the Common tab 1, tick “Item Level Targeting” 2 and click on Targeting 3.ģ. Edit your player right click on 1 and Properties.Ģ. The targeting at the level of the boundary element not the rights on the share, it is necessary even to set the rights NTFS on the file.ġ. It is also possible to limit the execution of the strategy to the level of the security filtering, which implies to make a strategy per reader. In this part, we will see how to limit the mapping to a user group using Item Level Targeting. Summary of the GPO, by default the drive will be mapped to all users. Drive 1 should be visible in Drive Mappings.ĩ. 1 Enter the location of the network shareĨ.Go to User Configuration> Preferences> Windows Settings and double click on Drive Mappings 1. Right-click on Strategy 1 and click on Edit 2 to open the editor.ĥ. Give a name with strategy and click OK 1.Ĥ. Create a new strategy, right-click on the domain name 1 or on an organizational unit and click on Create a GPO object in this domain, and link here 2.ģ. Open the Group Policy Editor on a domain controller.Ģ. Have a shared folder accessible to users to which it will be mapped.ġ.The logon script is certainly configured in a group policy, but the command gpupdate does not allow to replay the script, it is imperative to close then reopen the session to apply the script again. Record events in Windows Viewer for quick debugging.Lots of filtering options (even if not script we can do the same).They are updated regularly by client workstations and it is possible to force the update with the gpupdate command.Mapping network drives by group policy has several advantages for me: Through this tutorial, we will see that the result is identical. In this tutorial, I will show you two ways to mount a network drive, by GPO and using a script that must be executed at login, so using group policy as well. When setting up an Active Directory, one of the first things you want to set up is automatic mapping of network drives to different users.Īs a reminder, a network drive is a share presented to a workstation / user in the form of a letter like a hard disk / USB stick ….
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |