# New-ConfigurationExecute

Creates a module pipeline lifecycle action. Review available syntax, parameters, pipeline guidance, and reference details in PSPublishModule API Reference.

Project

PSPublishModule

Build, test, version, sign, and publish PowerShell modules with reusable PowerForge pipelines.

[View on GitHub](https://github.com/EvotecIT/PSPublishModule) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSPublishModule/releases/tag/v3.0.124) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSPublishModule/2.0.27)

Stars **48**

Forks **15**

Open issues **1**

PowerShell Gallery downloads **17,213**

Release **v3.0.195**

Language: C# Updated: 2026-11-25

Command 

**Module**

`PSPublishModule`

**Inputs**

`None`

**Outputs**

`PowerForge.ConfigurationActionSegment`

Creates a module pipeline lifecycle action.

## Syntax

```
New-ConfigurationExecute
[-At <ModulePipelineActionStage>]
[-ContinueOnError]
[-Disabled]
[-Environment <Hashtable>]
-InlineScript <String>
[-Name <String>]
[-PreferWindowsPowerShell]
[-TimeoutSeconds <Int32>]
[-WorkingDirectory <String>]
[<CommonParameters>]
```

[#](#method-new-configurationexecute-modulepipelineactionstage-switchparameter-switchparameter-hashtable-string-string-switchparameter-int32-string)

Parameter set: `Inline`

```
New-ConfigurationExecute
[-At <ModulePipelineActionStage>]
[-ContinueOnError]
[-Disabled]
[-Environment <Hashtable>]
-FilePath <String>
[-Name <String>]
[-PreferWindowsPowerShell]
[-TimeoutSeconds <Int32>]
[-WorkingDirectory <String>]
[<CommonParameters>]
```

[#](#method-new-configurationexecute-modulepipelineactionstage-switchparameter-switchparameter-hashtable-string-string-switchparameter-int32-string-2)

Parameter set: `File`

```
New-ConfigurationExecute
[-At <ModulePipelineActionStage>]
[-ContinueOnError]
[-Disabled]
[-Environment <Hashtable>]
[-Name <String>]
[-PreferWindowsPowerShell]
-ScriptBlock <ScriptBlock>
[-TimeoutSeconds <Int32>]
[-WorkingDirectory <String>]
[<CommonParameters>]
```

[#](#method-new-configurationexecute-modulepipelineactionstage-switchparameter-switchparameter-hashtable-string-switchparameter-scriptblock-int32-string)

Parameter set: `ScriptBlock`

## Description

Lifecycle actions run PowerShell at a named module pipeline context point such as AfterStaging, AfterManifest, or BeforePublish. PowerForge writes a stable JSON context file before each action and exposes its path through the POWERFORGE_CONTEXT environment variable.

Use lifecycle actions for project-specific preparation, generated-file adjustments, artifact checks, and release guardrails that need a precise pipeline context. Configuration segment order does not control execution order; the At value does.

## Examples

### Run an inline action after staging

```powershell
New-ConfigurationExecute -Name 'Inspect staged module' -At AfterStaging -InlineScript '$ctx = Get-Content $env:POWERFORGE_CONTEXT | ConvertFrom-Json; Get-ChildItem $ctx.ModuleRoot'
```

Runs the inline PowerShell after the module staging context exists.

### Run a script file before publishing

```powershell
New-ConfigurationExecute -Name 'Release guard' -At BeforePublish -FilePath '.\Build\Test-ReleaseReady.ps1' -TimeoutSeconds 120
```

Runs a repository script before publish steps execute.

## Parameters

**-At ModulePipelineActionStage optional**

Stable module pipeline lifecycle point where the action runs.

Possible values: `BeforeDependencies`, `AfterDependencies`, `BeforeVersioning`, `AfterVersioning`, `BeforeStaging`, `AfterStaging`, `BeforeBuild`, `AfterBuild`, `BeforeManifest`, `AfterManifest`, `BeforeDocumentation`, `AfterDocumentation`, `BeforeFormatting`, `AfterFormatting`, `BeforeValidation`, `AfterValidation`, `BeforeTests`, `AfterTests`, `BeforeSigning`, `AfterSigning`, `BeforeArtefacts`, `AfterArtefacts`, `BeforePublish`, `AfterPublish`, `BeforeInstall`, `AfterInstall`

**-ContinueOnError SwitchParameter optional**

When set, logs a failed action and lets the pipeline continue.

**-Disabled SwitchParameter optional**

When set, disables the action while keeping it in configuration.

**-Environment Hashtable optional**

Environment variable overrides passed to the action process.

**-InlineScript String requiredsets: Inline**

Inline PowerShell script text.

**-Name String optional**

Friendly action name shown in progress and result output.

**-PreferWindowsPowerShell SwitchParameter optional**

When set, prefer Windows PowerShell before pwsh on Windows.

**-TimeoutSeconds Int32 optional**

Action timeout in seconds. Defaults to five minutes.

**-WorkingDirectory String optional**

Optional working directory. Relative paths resolve from the project root.

**-FilePath String requiredsets: File**

Path to a PowerShell script file. Relative paths resolve from the project root.

**-ScriptBlock ScriptBlock requiredsets: ScriptBlock**

Inline PowerShell script block. The script block text is executed out-of-process.

## Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see [about_CommonParameters](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:34FACEA46B0E6017E393E429EE1AAAFB38C8E4715FF9840FABA763C9F15C3516 -->
