How does PowerShell handle large datasets?

Say Get-ChildItem returns millions of items. How does PowerShell handle this? Can I process data in batches? Will the command lock the console until data is received?

I am new to PowerShell, so it would be great if someone could explain the basic principles of handling operations that return many elements / can take a lot of time.

+4
source share
1 answer

Powershell cmdlets process data one record at a time. If you pass the get-childitem output to a script block or other cmdlet, it should run as parallel. That is, your script block will be executed as soon as a record is available, while get-childitem is still retrieving the records. Of course, since this is a console application, the console will naturally be locked until all records have been processed, unless you offer the user more data during record processing or the user completes the command. If you have time / resource handling, you might want your cmdlet to use a background job (see this msdn article ).

+6
source

All Articles