How to set file/folder permissions on a remote computer.

Say, for example, you want to grant permissions on a remote folder.  One way to do this is use the Microsoft XCACLS.VBS utility.

Go read the Microsoft article I linked to.

One important tip:
/E allows you to retain the existing ACLs for other users.  If you forget to use the /E switch, you end up deleting the existing ACLs.

A sample execution:

C:\Scripts>cscript xcacls.vbs \\POWERGIRL\c$\localdata\temp /e /g POWERGIRL\Users:M

Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

Starting XCACLS.VBS (Version: 5.2) Script at 4/11/10 3:11:59 PM

Startup directory:

Arguments Used:
        Filename = "\\POWERGIRL\c$\localdata\temp"
        /E (Edit ACL leaving other users intact)
        /G (Grant rights)

- Changing /G user/group: "POWEGIRL\Users" to "BUILTIN\Users"

Directory: \\POWERGIRL\c$localdata\Temp
Granting NTFS rights (M access for This Folder, Subfolders and Files) for "BUILT
Completed successfully.

Operation Complete
Elapsed Time: 6.625 seconds.

Ending Script at 4/11/10 3:12:06 PM