Powershell - Copy the folder with Permission (ACL)

The below script will copy the folder with ACL. Beauty is it will create the folder in the destination path if already not there, where as we can't do this from ROBOCOPY.

$finalreport = @()
$servers = Get-Content -Path "C:\Delete\directories.txt"
Foreach ($server in $servers)
{
ROBOCOPY "$server" "D:\TEST\$server" /MIR /SEC /pf /R:3 /v /LOG:C:\Delete\nameoflogfile123.txt
}

Comments

Popular posts from this blog

Troubleshooting Netlogon Error Codes

Troubleshooting AD Active Directory Replication Error 8456 or 8457: "The source | destination server is currently rejecting replication requests"

Service Principal Names (SPNs) SetSPN Syntax (Setspn.exe)