Hi jvierra,
thanks a lot for your help. It seems to work.
If the amount is big the progressbar runs slow as the copy process is work.
Code: Select all
# initiate
$pgb_robocopy.Value = 0
$global:currentcnt = 0
$global:totalcnt = (Robocopy "C:\Quelle" "C:\Ziel" /MIR /S /ETA /L /NC /NP).length - 1
#Create a New Job using the Job Tracker
Add-JobTracker -Name "JobName" `
-JobScript {
#--------------------------------------------------
#TODO: Set a script block
#Important: Do not access form controls from this script block.
Param ($Argument1)#Pass any arguments using the ArgumentList parameter
robocopy "C:\Quelle" "C:\Ziel" /MIR /S /ETA /NC /NP /R:10 /W:10 /TEE /LOG:"C:\temp\logfile_$(get-date -f MM-dd-yyyy).log"
#--------------------------------------------------
}`
-UpdateScript {
Param ($Job)
$global:currentcnt += ($Job | Receive-Job).Count
$percent = ($global:currentcnt / $global:totalcnt) * 100
if ($percent -lt 100)
{
$pgb_robocopy.Value = $percent
}
}`
-CompletedScript {
Param ($Job)
$pgb_robocopy.Value = 100
}
In the Direction good practice?
greetings
monoeagle