Jump to content

CMD or Powershell Script to give folder access?


0phoi5

Recommended Posts

Hi all,

I'm looking to make a script, in either batch or Powershell, that will give a user access to a folder and all folders leading down to it.

So, it would;

  • Ask for input of Active Directory UserID
  • Ask for input of a folder path
  • List all of the security groups for the first folder in the path and allow selection of which one the AD UserID will be added to.
  • List all of the security groups for the second folder in the path and allow selection of which one the AD UserID will be added to.
  • List all of the security groups for the third folder in the path and allow selection of which one the AD UserID will be added to.
  • etc.

So, if user JBLOGGS wanted access to folder '\\Here\There\Everywhere', the script would;

  • List the security groups for the folder '\\Here' and prompt for which AD group to add user JBLOGGS to.
  • List the security groups for the folder '\\Here\There' and prompt for which AD group to add user JBLOGGS to.
  • List the security groups for the folder '\\Here\There\Everywhere' and prompt for which AD group to add user JBLOGGS to.

Note - The security groups for a folder are normally viewable in Windows by right clicking in a folder and going to 'Properties > Security > Group or user names'

Hopefully this makes sense, if not please let me know.

Please note that I understand the script for adding a user to an AD group, that's easy. The struggle is getting a script to prompt which security group for each level of the folder path the user should be added to.

Thank you in advance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...