So I am pretty green at powershell, and I have looked around for similar issues but can't seem to find out what my issue is. My CSV has usernames from active directory in it, and would work if the @{user= }
wasn't there. I was pleased with myself for getting this far, but it seems I can't quite push it over the finish line. Please help StackOverFlow users!
$csvFile = 'C:\scripts\HomeDirectory\CN\CN-homedirectory.csv'
$SrcHome = '\\ch-hz-usrhome1\e$\Home\'
$DstHome = '\\us-svr-bk2\d$\files\CN_Files\'
Import-Csv $csvFile -Delimiter ";" | ForEach-Object {
$srcDoc = "$("$SrcHome$_.User")"
$dstDoc = "$("$DstHome$_.User\UsersHomeDrive")"
RoboCopy $srcDoc $dstDoc /Z /SEC /MIR /COPY:DAT /r:10 /w:40 /log+:C:\scripts\HomeDirectory\CN\CN_UserData.log
}
When I look at the log file, I see the following:
Source : \\ch-hz-usrhome1\e$\Home\@{User=xyu}.User\
Dest : \\us-svr-bk2\d$\files\CN_Files\@{User=xyu}.User\UsersHomeDrive\