Ask The Experts

Highlighted

xcp exit codes and errors

I'm calling xcp in a powershell script and i would like to capture exit code and the total files copied and\or scanned.

PS md $($account.newhome)
PS C:\netapp\xcp\xcp.exe copy $account.homedirectory $account.newhome

 

Below is an example of the last 5 lines output to screen:

 

57,262 scanned, 0 errors, 0 skipped, 57,259 copied, 34.1GiB (0/s), 9m50s
57,262 scanned, 0 errors, 0 skipped, 57,259 copied, 34.1GiB (0/s), 9m55s
57,262 scanned, 0 errors, 0 skipped, 57,261 copied, 36.9GiB (63.1MiB/s), 9m59s
Sending statistics...
Error sending statistics

1 REPLY 1
Highlighted

Re: xcp exit codes and errors

"RTM"

i took one last look in the manual and found the line

"The output of XCP SMB commands can be redirected using the “>” operator. For example:"

# 2c write source and destination to a file just in case + create log file as samusername.txt
write-output $account.name "has a home directory located here:", $account.homedirectory | out-file -filepath C:\test\moving.txt -Append
write-output "wer're moving it here:", "$($account.newhome)`n" | out-file -filepath C:\test\moving.txt -Append
write-host $account.samaccountname "log file", $account.homedirectory | out-file -filepath C:\test\user_logs\"$($account.samaccountname).txt"

# 2d make new HomeDirectory based on samaccountname and xcp to new storage array
# then set aduser homedirectory path and drive in profile and also remove any login.vbs
md $($account.newhome)
C:\netapp\xcp\xcp.exe copy $account.homedirectory $account.newhome | out-file -filepath C:\test\user_logs\"$($account.SamAccountName).txt"
set-aduser -Identity $($account.samaccountname) -Homedirectory $($account.newhome) -HomeDrive "H:" -ScriptPath " "

 

View solution in original post

Check out the KB!
Knowledge Base
All Community Forums