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

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

Troubleshooting SCEP certificate profile deployment to Android devices in Microsoft Intune