Thread Synchronization (lock statement) in PowerShell

While reading today's "Hey, Scripting Guy!" blog post by Boe Prox, I learned that it is possible to have multiple threads / runspaces accessing the same live objects in a PowerShell session, something I had previously thought was not possible. Seeing that, I decided to write a "lock" statement for PowerShell, which can be necessary in some circumstances. See the original blog post for the function and more information.

About the Author

Dave Wyatt

Dave Wyatt is a Microsoft MVP (PowerShell) and a member of's Board of Directors.