I'd like to change NTFS file system permissions and ownership using Powershell, both at the command line and from a Powershell script.
I come from the Unix world, where it's pretty straightforward: To change ownership, you use the 'chown' command, and to change permissions, you use either 'chmod' or 'setfacl'.
How would I do the same thing in Powershell? I'd like to be able to do this locally (on a Windows Server 2003 box), and hopefully remotely (from a Windows XP client, say).
Googling around, I see many different discussions threads, with conflicting information about how you might do it (try this script I wrote, download this utility, etc.), or whether it's even possible to change the owner to a non-Administrative user account using anything other than the security tab in the GUI. I'm surprised such a basic operation is such a fertile topic for discussion and debate.
I did see the "How Can I Take Ownership of a File or Folder By Using a Script?" entry in the Scripting Guys archive, describing how to use VBscript to take ownship of a file, but what I want to do is, as the Administrator, say, change the ownership of a file to another user, say "joeplumber".
In Unix, I can do something like, "chown joeplumber notes.txt" and "chmod u+w notes.txt". Is there something similarl in the Windows world that doesn't require downloading a utility that doesn't ship with the OS?
Powershell is pretty cool, and I'm hoping I can use it to accomplish my task.
Thanks in advance!
-David