Partilhar via


Saving Your Workflow in a Module

 

Applies To: Windows Server 2012, Windows Server 2012 R2

After authoring a Windows PowerShell script workflow as described in Writing a Script Workflow, or authoring a XAML workflow, you can save the workflow as a module. Storing workflows in a module makes it easier for you to package, distribute, describe, and install them easily.

Prepare your workflow by saving it in a module

The example workflow in the following procedure, Install-Role.ps1, is a Windows PowerShell script workflow.

To save a workflow in a module

  1. Create a module directory. The following example command creates a module directory called ManagedRoles in the user's Modules directory.

    mkdir C:\Users\CoolDev\WindowsPowerShell\Modules\ManagedRoles

    Important

    Do not name a module the same name as any other modules that are located in your module path.

  2. Copy at least one Windows PowerShell script-based or XAML workflow file into the module directory, as shown in the following example command.

    copy-item .\Install-Role.ps1 -dest C:\Users\CoolDev\WindowsPowerShell\Modules\ManagedRoles

See Also

Getting Started with Windows PowerShell Workflow Writing a Script Workflow Configuring Your Workflow Environment Running a Windows PowerShell Workflow about_Modules