question

SKG-6000 avatar image
0 Votes"
SKG-6000 asked

Powershell ThrottleLimit limit

Hi All,

I am using Powershell 7.1.4

I have following script. My goal is to execute 10 calls to a SP in parallel. But i am observing at a given time only 5 calls are being made to sql server

any ideas

1..10 | ForEach-Object -Parallel {
$ServerName = "mssql"
$DatabaseName = "testdb"
$Password = "Password!"
$UserId="sa"

     $query="exec [Test].[spPopulateTestTable] @SWID =519692, @MaxThreads =5, @CurrentThreadId =$_"
     Invoke-Sqlcmd -Server $ServerName -Database $DatabaseName -Password $Password -User $userid -Query $query
     Write-output "Completed $Thread"
        
 } -ThrottleLimit 10

TIA

windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers