foreach which best design

Welcome Forums General PowerShell Q&A foreach which best design

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
4 years, 11 months ago.

  • Author
    Posts
  • #12249

    Participant
    Points: 0
    Rank: Member

    hello
    i want to create a workflow that copy large file to multiple computers.
    i could encapsulate Foreach keyword on the workflow definifion like this
    workflow Copy-Largefiles
    {
    foreach -parallel ($computer in $computers)
    OR i could use the parameter like this Copy-Largefiles -PSComputername $computers
    Which is best design and consume less resources..
    thank you

  • #12250

    Keymaster
    Points: 1,704
    Helping HandTeam Member
    Rank: Community Hero

    The foreach block will execute entirely on the computer that is running the workflow.

    If you use the -PSComputerName approach, then the workflow will be distributed to the specified computers and will run locally on each of them. That happens over Remoting, which is a pre-requisite for that technique.

  • #12254

    Participant
    Points: 0
    Rank: Member

    thank you

The topic ‘foreach which best design’ is closed to new replies.