Blog Post

Jobs in PoSh to Create a Load

,

I saw this from Argenis Fernandez, and thought it was wonderful.

1..128 | % { start-job -name ‘job name’ -scriptblock { & sqlcmd -S instanceName -U sa -P ‘iLovePoSh’ -i /home/username/test.sql } }

Create 128 threads, each running a background job in PowerShell to connect to an instance and run a script file.

Start-Job is used to begin a job, and then you can get information from Get-Job and use Stop-Job to turn things off.

Very cool. Looking forward to trying to use this in a demo and make things happen.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating