PowerShell Unable To Load Module When Process Has Too Many Steps


I am running version and all of my tentacles are up to date. I have a project that has a large number of steps (57 steps, some of which are under the 9 parents steps - so a total of 66 steps when you include the parent steps/step groupings). I have a steps that tries to load the WebAdministration module to set up a web site, but I get this error every time it runs:

Get-Website : Could not load file or assembly
’Microsoft.IIS.PowerShell.Framework’ or one of its dependencies. The system
cannot find the file specified.
At C:\Windows\system32\config\systemprofile\AppData\Local\Tentacle\Temp\10e32b3e-c943-481f-9738-8a3c295d1b4b.ps1:80 char:10

  • $site = (Get-Website | Where-Object { $_.Name -eq $parentSite })
  •      ~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:slight_smile: [Get-Website], FileNotFoundException
    • FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.IIs.PowerShell.Provider.GetWebsiteCommand

If this step is the only step in the project (if I create a new project and have just that step), then it runs fine. Otherwise, if I delete a few of the steps (the fewest I have deleted and had success with is 9 steps with 2 parent steps/step groupings, bringing my total down to 55 steps including the parent steps).

I am trying to load the WebAdministration module like this:

Add-PSSnapin WebAdministration -ErrorAction SilentlyContinue
Import-Module WebAdministration -ErrorAction SilentlyContinue

Is this a known bug or limitation? Has anyone else run into similar issues? Is there a workaround/fix?

Any help would be appreciated! Thanks!

Hi Nick,

Thanks for reaching out. Does it fail on a random step each time or it consistently fails on just 1?



It fails consistently on the 1 step.

I have started from scratch by cloning the project (to rule out an issue with variables), deleting every step except the 1 it fails on, and it works just fine. I am now going through the process of adding steps back in a couple at a time to see when I start to have issues.

Hi Nick,

Keep us posted on that progress. If you happen to run into another failure while adding the steps, please send us a full deployment log.


I guess this might not have anything to do with the number of steps. We found this link and it seems to have fixed it for us: http://help.octopusdeploy.com/discussions/problems/5172-error-using-get-website-in-predeploy-because-of-filenotfoundexception