Setup: You want to copy all the permissions from one file to another with PowerShell

Move to the folder of the source file

$Permissions=GET-ACL SourceFile.ext

Move to the folder of the destination file:

SET-ACL DestFile.ext –aclobject $Permissions

This method is very useful for copying the permissions of .vhd files after you move/copy them between different folders/virtual machines.
Before attaching a vhd file to a Hyper-V virtual machine use these commands to copy the permissions from existing vhd to new vhd.

Leave a Reply

Your email address will not be published.