I have a mixed bag of modules I’m trying to stitch together into a coherent AZ DevOps release process. Several of these modules only support up to PowerShell 5.1, however, the features I’m trying to leverage are in PowerShell 7 – specifically the ForeEach-Object -Parallel cmdlet.
Does it seem realistic that using Add-Type ‘Microsoft.PowerShell.Core’ within the function from which I will call the ForeEach-Object -Parallel. The scriptblock calls a self-contained script that can run as either PoSh 5 or 7. I know that I can inline the download and use of some modules (i.e. ThreadJobs show up in 6). Doc’s say I cannot use Import-Module.
The features I’m most desiring to use of ForEach-Object are: -Parallel (obvious) -ThrottleLimit and -AsJob.
In the alternative… would it make sense to stay in 7 and “downgrade” to 5 for the Modules that don’t support 7?
I’m using this as part of a multi-tenant DB release process for a little over 200+ databases. Some DBs are big and take a while, others not so much. There’s are a mixture of ~70 scripts that I apply and include backup, applying MDM data, release, rollback (for failure), and status reporting.
Insight and guidance will be appreciated.
I tried download & import of ThreadJob module from PoSh 6 and have had limited success with this. I hope leveraging 7 with FEO -Parallel will solve my issue.