8,329 questions
Powershell ThrottleLimit limit
SKG
66
Reputation points
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 for business | Windows Server | User experience | PowerShell
Sign in to answer