I'm looking for some advice regarding a deployment issue I'm facing with AWS CodeDeploy. My goal is to speed up deployments by running certain PowerShell scripts as parallel jobs instead of sequentially. However, I'm encountering difficulties specifically with scripts that use the WebAdministration or IISAdministration modules. When I run these scripts individually, they work perfectly fine, but when I try to execute them as jobs or via start-process, the IIS module commands seem to malfunction and don't execute as expected. I've confirmed that the modules can be loaded in these child scripts, but the commands yield no output. Is this a recognized issue related to IIS modules not functioning when invoked as parallel jobs or child scripts? If so, what workarounds exist?
2 Answers
It's tough to diagnose the issue without seeing your code, but it sounds like the WebAdministration module relies on a PSDrive that may not be accessible in your job context. I'd recommend checking whether the IIS: PSDrive is available using commands like test-path or get-childitem before running your IIS-related commands. Also, have you considered using 'Invoke-Command'? It allows for asynchronous execution and might be more reliable for your scenario than jobs or start-process.
I get what you're saying about the deployment scripts running sequentially by default; it's a common bottleneck. If the IIS commands work fine in a regular script but not when called from jobs, it might be a situation where those commands need to have a specific context when executed. Your idea to try Invoke-Command is solid, though if you're using CodeDeploy, make sure your syntax is on point there. Sometimes commands dealing with IIS can be finicky when not in the primary script context. It might be worth revisiting how you structure those calls.
Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures