Here is my dilemma. We have a server with a path, say \server1\data$\foo\bar\stuff. I’m using Windows 2005 Server for this. Now, for \stuff, I’d like to add something like 150 users that I have in a CSV file (can get it from Excel).
I can parse the CSV file rather easily (most languages have libraries for this), but I don’t know anything about Windows permissions (used Linux for quite a bit of my career prior).
Can I do this in PHP?
You can do this from the command line via active directory commands through DOS or Powershell. I list some references and examples from references below.
I would suggest adding these users to a group. This example adds a user to a group:
Reference: http://technet.microsoft.com/en-us/library/cc732423(WS.10).aspx
To create a group, see the dsadd command. Example of creating a group:
One option on Windows, through DOS is Cacls, iCacls, and other variants. This example adds Read permissions to a resource for the group, ‘Power Users’:
Reference: http://ss64.com/nt/cacls.html
I have read that CACLS can be buggy, so you may want to look into another variant of CACLS. I highly recommend http://ss64.com
If you don’t know the exact OU/CN, etc for users or groups, you can check it out with something like this:
Similarly for groups
Let me know if you get stuck and I can put more effort into this. Powershell is another option worth looking into.