How to import the completed job parameter?

Hello everbody,
i am glad there is a forum to search for help.
I am a powershell noob so please feel free to explain a LOT :stuck_out_tongue:

What do I want?
I would like to run a job with powershell.

the first part (of whats interessting for you) of the code would be:

$job = {Copy-Item -Path C:\Users\lscho\Desktop\quelle -Destination C:\Users\lscho\Desktop\ziel -Recurse -Force}
start-job -Name Kopieren -ScriptBlock $job

so far so good… this works as it should be :slight_smile:
Copying from A to B. Perfect!

But: I would like some kind of… Waiting Output.
My first attempt is this:

$job = {Copy-Item -Path C:\Users\lscho\Desktop\quelle -Destination C:\Users\lscho\Desktop\ziel -Recurse -Force}
start-job -Name Kopieren -ScriptBlock $job

Do
{
“Coyp runs”
Wait-Event -Timeout 1
}
Until (>>>>job is completed<<<<)
“Copy done”
pause

The >>>>job is completed<<<< is the problem, becasue i have no idea how to “import” the status of the job… or how to leave the dowhile.

is there anybody who has a clever idea? :slight_smile:
thank you in advance! :slight_smile:

Did you try the cmdlet

?

I’d recommend to always read the help of the cmdlets you’re about to use COMPLETELY INCLUDING THE EXAMPLES to learn how to use them