Error using Get-WebSite in PreDeploy because of FileNotFoundException

Ah! Sorry :slight_smile:

Med venlig hilsen | Best regards

Claus Topholt

This line fixed our issue (PowerShell 4.0 + Octopus 2.5)

try {Get-WebSite | Out-Null} catch {}

We solved this is a different way; our Tentacles run as a deployment user so we added

Import-module WebAdministration to the Powershell profile for that user

A bit hacky but works very well for us

As I understand, the problem is still not fixed? I’m getting the same error with IIS Virtual Directory — Create script.

 Failed: IIS Virtual Directory - Create

20:27:35   Info     |         Running "IIS Virtual Directory - Create" on "DON"

                    |       

                    |         Failed: Tentacle script execution

20:27:35   Verbose  |           Running PowerShell script: C:\Windows\system32\config\systemprofile\AppData\Local\Tentacle\Temp\e75262ec-69be-4fdc-bcb4-26fdd921c881.ps1

20:27:37   Info     |           Virtual path: sitemaps

                    |           Physical path: C:\sitemaps

                    |           Parent site: Zakupki.Front

                    |           Getting web site Zakupki.Front

20:27:38   Error    |           Get-Website : Could not load file or assembly 'Microsoft.IIS.PowerShell.Framewo

20:27:38   Error    |           rk' or one of its dependencies. The system cannot find the file specified.

20:27:38   Error    |           At C:\Windows\system32\config\systemprofile\AppData\Local\Tentacle\Temp\e75262e

20:27:38   Error    |           c-69be-4fdc-bcb4-26fdd921c881.ps1:75 char:9

20:27:38   Error    |           + $site = Get-Website -name $parentSite

20:27:38   Error    |           +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

20:27:38   Error    |           + CategoryInfo          : NotSpecified: (:) [Get-Website], FileNotFoundExc

20:27:38   Error    |           eption

20:27:38   Error    |           + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.IIs.Po

20:27:38   Error    |           werShell.Provider.GetWebsiteCommand

20:27:38   Info     |           ==============================================

                    |           PowerShell exit code: 1

                    |           ==============================================

20:27:38   Fatal    |           PowerShell script returned a non-zero exit code: 1

                    |           Tentacle version 2.6.5.1010