Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

Copy directory structure with access permissions

$
0
0

This seems like a fun one.  I have a user share that has a folder for each one of my users that only they have access to. When I run Get-Childitem -Path \\Server1\users -directory, I get a list of all of the user directories.  I want to make another set of these directories on a different server, but have the same access controls.  Only the individual user will have access to the folder.  I don't want to transfer any data.  Here is an example of the test I did to copy just the directories:

Get-Childitem -Path \\Server1\users -Directory -Filter d* | Copy-Item -Destination \\Server2\share

 The question is how do I get the same list of directories with the same access permissions for the individual users?


Viewing all articles
Browse latest Browse all 10624

Trending Articles