I am trying a very simple PowerShell Parallel example as specified in the documentation.
1..5 | ForEach-Object -Parallel { "Hello $_"; sleep 1; } -ThrottleLimit 5 
But its giving the following error, any help in this regards would be appropriated.
ForEach-Object : Parameter set cannot be resolved using the specified named parameters.
At C:\temp\parallel.ps1:2 char:9
+ 1..10 | ForEach-Object -Parallel {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : MetadataError: (:) [ForEach-Object], ParameterBindingException
 + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.ForEachObjectCommand
Following is my PowerShell Version information
Name Value
---- -----
PSVersion 5.1.18362.752
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.752
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
 3 Answers 3
ForEach-Object -Parallel has been introduced in PowerShell 7.0. You are using PowerShell 5.1. That's why it doesn't work.
If you have PowerShell 7.0 installed in parallel (which is possible), call the PS executable directly and execute your script with that.
Comments
The documentation shows powershell 7 by default, which could be confusing.
A start-job alternative, but it's multi-process:
1..5 | ForEach-Object { start-job { 
 "Hello $args"; sleep 1 } -args $_ } | receive-job -wait -auto
You could download threadjob in powershell 5, which is faster than start-job. https://www.powershellgallery.com/packages/ThreadJob. It comes with powershell 7. It works like foreach-object -parallel.
1..5 | ForEach-Object { start-threadjob { 
 "Hello $using:_"; sleep 1 } } | receive-job -wait -auto
 Comments
As the previous answers specified, Foreach-Object -Parallel is available in PowerShell 7. 
Still if you need to execute commands in parallel, you may try to explore workflows. More details, could be found in PowerShell help: Get-Help about_Workflows -ShowWindow.