0

I would like to ask. How can I set up automatically permissions for folder which is created by GPMC this method: http://www.morgantechspace.com/2014/03/Create-a-Folder-on-Desktop-through-Group-Policy.html

Server creating this folder automatically for every user which is logged in for the first time.

Thank you very much for help

0

You can create a batch file to do this and use the same GPO to run the batch file after create the folder.

  1. Create a bat file and write:

timeout 10

icacls "%userprofile%\Desktop\SupportTeam" /grant Everyone:M

Timeout 10 to wait until the folder is created. Everyone:M is to grand Everyone access to the folder.

  1. Put the batch file on a shared folder on your network. Make sure to Everyone have access to this shared folder.

  2. Add the batch file to the GPO --> User Configuration --> Windows Settings --> Scripts--> Logon

Click on Add --> Browse for the batch file (where you save the bat file "The Shared folder on your network", you don't need to add any script parameters).

  1. Logoff and back in. (permissions are applied when the user logs on to the computer).
| improve this answer | |
  • Oh thank you, but what If I want to change "Everyone" to user who is logging in? I think that will be a little bit complicated isn't it? – Patrik RainbowShaggy Nov 10 '16 at 22:01
  • Change "Everyone" to %userdomain%\%username%. The problem you will probably have though is you are not running this in the logged on user's security context, so %username% may incorrectly identify the account. Typically, the folder would be created in the user's home directory on your file server as part of the user creation script and the permissions would be set for that user later in that script. You can then you group policy to create a shortcut to the folder. – user5870571 Nov 11 '16 at 1:51
  • Oh maybe that will works. Because you know. I have problem with that I have this structure: D:\Users Data |---Tom |---Martin |---Another user And in these folders I'm using redirection for downloads and documents and everything and what I need is create in these folders another folder automatically with specific permissions for user. And my problem is that, user can't access to "D:\Users Data", but If someone find someone name and put into address panel: D:\Users Data\Tom, he can access to this folders, but not subfolders created with redirection. – Patrik RainbowShaggy Nov 11 '16 at 7:24
  • Okay, I maybe solved the problem. I think that group Authenticated users could solve the problem. And I think when I create the folder with script and no with the GPO. The permissions should be setted up correctly for the folder, because it would be like created by the user and not by the system. – Patrik RainbowShaggy Nov 11 '16 at 11:26
  • Please give some credit to the answer If that help to fix your issue. – HEMAN85 Nov 11 '16 at 16:15
0

Okay. Sorry. I can't write earlier. So I tried create new folder using your steps, but the script don't run and I don't know why. I setted up excactly how you describe.

So. My script is located here:

\\SERVER-LUNA\Scripts$\wwwroot dir.bat

and Everyone have access to this script and here is my wwwroot dir.bat

timeout 10
if not exist "\\SERVER-LUNA\Users$\%username%\wwwroot" mkdir "\\SERVER-LUNA\Users$\%username%\wwwroot"

When I run the command manually, it works. Thanks

| improve this answer | |
  • I think you're missing a few think on your path. It should be something like this: \\SERVER-LUNA\C$\Users\%username%\wwwroot You can put a pause on the script and check for any errors (Pls post the error if any). – HEMAN85 Nov 11 '16 at 21:02
  • I think, that the script don't run with the user login. My path is correct.The Users folder is located on D drive and is shared like Users$. – Patrik RainbowShaggy Nov 11 '16 at 21:03
  • Is a GPO script, should run fine if is configured correctly. Add a pause to the script and post the error. – HEMAN85 Nov 11 '16 at 21:06
  • I don't see a mistake anywhere. – Patrik RainbowShaggy Nov 11 '16 at 21:20
  • Okay. Now I'm noticed, that the folder is created, but after few minutes. Don't know why.. – Patrik RainbowShaggy Nov 13 '16 at 0:49
-2

I found the solution why is logon script via GPO delayed. You need to enable and change policy via GPO: https://support.microsoft.com/en-us/kb/2895815

Thanks for help

| improve this answer | |
  • Welcome to Server Fault! Whilst this may theoretically answer the question, please provide context around links so others will have some idea what it is and why it’s there. If possible summarise or quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline. – HBruijn Nov 15 '16 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.