Export (0) Print
Expand All

Saving Your Workflow in a Module


Updated: June 24, 2013

Applies To: Windows PowerShell 5.0, Windows Server 2012 R2, Windows Server 2012, Windows PowerShell 4.0, Windows 8

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.

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


    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

© 2016 Microsoft