Skip to content

Deploy to IIS step fails when using PowerShell 7.3+ #9373

Open
OctopusDeploy/Calamari
#1479
@octopus-hideaki

Description

@octopus-hideaki

Severity

Low

Version

Earliest reported: 2024.3.12985

Latest Version

I could reproduce the problem in the latest build

What happened?

When running the Deploy to IIS step on a target with PowerShell version 7.3+ installed, the deployment step fails with the message: ObjectNotFound: Cannot find drive. A drive with the name 'IIS' does not exist.

Reproduction

  1. Install the latest version of PowerShell Core on the target
  2. Create a deployment with Deploy to IIS step
  3. Enable PowerShell Edition under Configure features
  4. Select PoweShell Core under PowerShell Edition
  5. Deploy a IIS package

Error and Stacktrace

15:54:15   Verbose  |       Invoking target script 'C:\Octopus\Applications\Development\iis-package\1.0.1_2\Octopus.Features.IISWebSite_BeforePostDeploy.ps1'.
15:54:19   Verbose  |       Detected IIS Version 10.0
15:54:20   Info     |       �[33;1mWARNING: Module WebAdministration is loaded in Windows PowerShell using WinPSCompatSession remoting session; please note that all input and output of commands from this module will be deserialized objects. If you want to load this module into PowerShell please use 'Import-Module -SkipEditionCheck' syntax.�[0m
15:54:20   Info     |       Making sure a Website "Default Web Site" is configured in IIS...
15:54:20   Error    |       ObjectNotFound: Cannot find drive. A drive with the name 'IIS' does not exist.
15:54:20   Error    |       At C:\Octopus\Applications\Development\iis-package\1.0.1_2\Octopus.Features.IISWebSite_BeforePostDeploy.ps1:582 char:2
15:54:20   Error    |       +     pushd IIS:\
15:54:20   Error    |       +     ~~~~~~~~~~~
15:54:20   Error    |       at <ScriptBlock>, C:\Octopus\Applications\Development\iis-package\1.0.1_2\Octopus.Features.IISWebSite_BeforePostDeploy.ps1: line 582
15:54:20   Error    |       at <ScriptBlock>, <No file>: line 1
15:54:20   Error    |       at <ScriptBlock>, C:\Octopus\Applications\Development\iis-package\1.0.1_2\Octopus.FunctionAppenderContext.ps1: line 276
15:54:20   Error    |       at <ScriptBlock>, C:\Octopus\Applications\Development\iis-package\1.0.1_2\Bootstrap.Octopus.FunctionAppenderContext.ps1: line 1844
15:54:20   Error    |       at <ScriptBlock>, <No file>: line 1
15:54:20   Error    |       at <ScriptBlock>, <No file>: line 1
15:54:20   Verbose  |       Deleting 'C:\Octopus\Applications\Development\iis-package\1.0.1_2\Octopus.Features.IISWebSite_BeforePostDeploy.ps1'
15:54:20   Verbose  |       Calamari.Common.Commands.CommandException: Script 'C:\Octopus\Applications\Development\iis-package\1.0.1_2\Octopus.Features.IISWebSite_BeforePostDeploy.ps1' returned non-zero exit code: 1
15:54:20   Verbose  |       at Calamari.Deployment.Conventions.FeatureConventionBase.ExecuteFeatureScripts(RunningDeployment deployment, String feature, HashSet`1 embeddedResourceNames) in C:\BuildAgent\work\e61a42f6adc5dcb6\source\Calamari\Deployment\Conventions\FeatureConvention.cs:line 137
15:54:20   Verbose  |       at Calamari.Deployment.Conventions.FeatureConventionBase.Run(RunningDeployment deployment) in C:\BuildAgent\work\e61a42f6adc5dcb6\source\Calamari\Deployment\Conventions\FeatureConvention.cs:line 83
15:54:20   Verbose  |       at Calamari.Deployment.Conventions.FeatureConvention.Install(RunningDeployment deployment) in C:\BuildAgent\work\e61a42f6adc5dcb6\source\Calamari\Deployment\Conventions\FeatureConvention.cs:line 27
15:54:20   Verbose  |       at Calamari.Deployment.ConventionProcessor.RunInstallConventions(IEnumerable`1 installConventions) in C:\BuildAgent\work\e61a42f6adc5dcb6\source\Calamari.Shared\Deployment\ConventionProcessor.cs:line 80
15:54:20   Verbose  |       at Calamari.Deployment.ConventionProcessor.RunConventions(Boolean logExceptions) in C:\BuildAgent\work\e61a42f6adc5dcb6\source\Calamari.Shared\Deployment\ConventionProcessor.cs:line 31

More Information

No response

Workaround

Use Windows PoweShell

Metadata

Metadata

Labels

kind/bugThis issue represents a verified problem we are committed to solving

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions