Powershell Process 5 Csvs Simultaneously

Home Forums Scripting PowerShell Powershell Process 5 Csvs Simultaneously

This topic contains 3 replies, has 3 voices, and was last updated by  dalesnail 1 year ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts

  • confuseis
    Participant
    #167326

    Hi

    I’m looking to run a command/check against every machine in our domain

    I can export all the relevant PC’s to a 5000 row csv file and then use a loop to run a command against them one at a time

    This does work. However cycling through the PCs one at a time will take days.

    Id really like to process all the PCs in a few hours

    Best way I can think of to do that is to split the main csv into 5 smaller 1000 row csv files and then process all 5 simultaneously

    This way I could get the answer much quicker. Ideally id like to avoid running 5 scripts each processing 1 csv. Id prefer to have just one script running.

    Is it possible to do this ?

    Thanks for reading


    dalesnail
    Member
    #383884

    Im thinking I would need 5 e.g. foreach($item in $CsvSection1of5) loops but all run at the same time


    Anonymous
    #372076

    Have a read at this link, foudn thru :google:: ‘https://blogs.technet.microsoft.com/uktechnet/2016/06/20/parallel-processing-with-powershell/’; it should set you up with an answer that will work for you. It describes how to get PS to run multiple tasks simultaneously, just what you’re after.


    dalesnail
    Member
    #383885

    Ah Parallel processing was the keyword I was looking for.

    I’ll have a read and test and post my summary

    Thanks

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.