Issues icon indicating copy to clipboard operation
Issues copied to clipboard

Deploying a Windows Service can fail if PowerShell Core feature is selected

Open benPearce1 opened this issue 9 months ago • 0 comments

Severity

Workaround available

Version

All

Latest Version

I could reproduce the problem in the latest build

What happened?

A Deploy a Windows Service step will fail if the step is configured to run with PowerShell Core.

PowerShell Core doesn't support WMI calls, which the Windows Service step relies on.

Reproduction

Add a Deploy a Windows Service step Click Configure Features and select the PowerShell Edition feature In the PowerShell Edition feature section, select PowerShell Core

Error and Stacktrace

Method invocation failed because [Deserialized.System.Management.ManagementObject#root\cimv2\Win32_Service] does not contain a method named 'change''

More Information

The WMI calls in https://github.com/OctopusDeploy/Calamari/blob/main/source/Calamari/Scripts/Octopus.Features.WindowsService_BeforePostDeploy.ps1 will need to be replaced with their CIM equivilants

Workaround

Ensure that the PowerShell Edition is set to Windows PowerShell (Desktop) or remove the feature from the step

benPearce1 avatar Jan 15 '25 07:01 benPearce1