Skip to content

Instantly share code, notes, and snippets.

@vors
Last active January 19, 2022 08:49
Show Gist options
  • Save vors/151d24e7291732971e83 to your computer and use it in GitHub Desktop.
Save vors/151d24e7291732971e83 to your computer and use it in GitHub Desktop.
CPUKiller PowerShell transcript
>> Register-PSSessionConfiguration -SessionType Workflow -Name CPUKiller -SessionTypeOption (New-PSWorkflowExecutionOption -MaxActivityProcesses 100)
114 [C:\windows\system32]
>> $s = New-PSSession -ConfigurationName CPUKiller
115 [C:\windows\system32]
>> icm $s {
>>> workflow Test-Myworkflow {
>>> param
>>> (
>>> [string[]]$bar
>>> )
>>>
>>>
>>> foreach -parallel -throttlelimit 10 ($foo in $bar) {
>>>
>>> parallel {
>>>
>>> inlineScript {
>>>
>>> @{one="one $(([datetime]::Now).timeofday) $using:foo"}
>>> Start-Sleep -Seconds 200
>>>
>>> }#InlineScript
>>>
>>> }#parallel
>>>
>>> }#Foreach-parallel
>>> }#Test-Myworkflow
>>> }
116 [C:\windows\system32]
>> icm $s { Test-Myworkflow a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v }
WARNING: [localhost]:This workflow job cannot be suspended because there are no checkpoints (also called persistence points) in
the workflow. To make the workflow job suspendable, add checkpoints to the workflow.
For more information about how to add checkpoints, see the help topics for Windows PowerShell Workflow.
Name Value
---- -----
one one 10:16:59.8023607 i
one one 10:17:00.8054870 f
one one 10:17:03.7988649 e
one one 10:17:04.7309828 j
one one 10:17:05.7991176 d
one one 10:17:08.3024338 h
one one 10:17:10.7977868 g
one one 10:17:16.2984798 c
one one 10:17:18.7978168 b
one one 10:17:19.8889707 a
one one 10:20:21.0588871 k
one one 10:20:21.0628850 l
one one 10:20:24.0064259 m
one one 10:20:24.9419622 n
one one 10:20:26.0024368 o
one one 10:20:28.5102442 p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment