Auto Mapping Network Drives

group-policymappeddrivewindows-server-2012-r2

I'm an IT Apprentice trying to use a group policy (in Windows Server 2012) to auto map network folders when someone first logs on to a machine. This is the batch file I have written and the 'Share' folder maps at logon, but the 'personal' folder doesn't map.

NET USE */delete
NET USE C: \\3AAA-LIVERPOOL\Home$\%LogonUser% /PERSISTENT:YES
NET USE C: \\3AAA-LIVERPOOL\Share /PERSISTENT:YES

I have manually mapped the folder on the client machine but the GPO won't auto map the file.

What is the correct code to do this?

I figured it was an it was an issue with the path but the same path works when manually mapped on the client machine.

Thank you:)

Best Answer

First of all, you are trying to map your shared folder to drive C, which is usually taken by your Windows installation. Instead you want to map it to a free drive letter like M, P, Q, S, … whatever is free.

NET USE S: \\3AAA-LIVERPOOL\Share

Secondly, you are trying to map multiple network shares to a single drive letter. This does not work, only one network share per drive letter is allowed. Aynthing else would not make sense.

NET USE H: \\3AAA-LIVERPOOL\Home$\%LogonUser% /PERSISTENT:YES
NET USE S: \\3AAA-LIVERPOOL\Share /PERSISTENT:YES

Third, %LogonUser% does not exist, see echo %LogonUser%. You probably want to use %username%. (Environmental variables are case-insensitive, btw.)

Fourth, there is a better way to configure a home directories for your users documented here: https://blogs.technet.microsoft.com/askds/2008/06/30/automatic-creation-of-user-folders-for-home-roaming-profile-and-redirected-folders/

Fifth, there is a better way to map drives other than the home directory, as Slipeer already pointed out. But I'll mention it, too, for the sake of completeness.

Last, you are missing a white space in the delete command.

NET USE * /delete