Author Posts

August 18, 2017 at 5:36 am

Hi,

I Powershell, if we have 10 lines of code – is each line of code is executed sequentially?

If there is copy statement in 4th line and in case if the copy takes around 5 mins to complete, when will be 5th line execute? Does it wait for the copy to complete and then the control move to next line?

Please clarify and many thanks in advance!

August 18, 2017 at 6:02 am

Hi,

you should urgently start to learn the basics of Powershell and maybe a little basic computer technology in general. I think it will pay off for you in the future.

is each line of code is executed sequentially

Yes.

If there is copy statement in 4th line and in case if the copy takes around 5 mins to complete, when will be 5th line execute? Does it wait for the copy to complete and then the control move to next line?

If you're not sure about something – you should try it by yourself. Then you know it for yourself.

August 18, 2017 at 8:13 am

Thanks very much Olaf. Yes, I am new to Powershell and I have been using PowerShell since last 2 days. Can you please let me know where I can start with learning the basics of PowerShell? I used to go through some YouTube videos, but if you can suggest it would be of great help.

Thanks in advance!

August 18, 2017 at 8:21 am

Here you have some good resources to start with: Beginner Sites and Tutorials

August 18, 2017 at 8:24 am

Unless you're using PowerShell workflows or runspaces (as a new user don't even think about it at this stage) all commands run sequentially. One command has to finish before the next can start. if you're using a pipeline then the pipeline is effecively treated as a single command – {to more experienced users I KNOW that's a simplification but its accurate enough for this discussion)

In terms of learning PowerShell you should take a structured approach – the Microsoft MVA, or an introductory level book such as PowerShell step by Step or the Month of Lunches book

August 18, 2017 at 9:59 pm

I would highly recommend the Learn Windows PowerShell In A Month of Lunches book in concert with the Microsoft MVA Getting Started With Microsoft PowerShell course. They compliment each other.

Then, if you want to go further, I highly recommend Learn PowerShell Toolmaking In A Month Of Lunches in concert with the Microsoft MVA Advanced Tools & Scripting with PowerShell 3.0 Jump Start course. Again, they compliment each other.