Export-CrescendoModule

Creates a module from PowerShell Crescendo JSON configuration files

Syntax

Export-CrescendoModule
      [-ConfigurationFile] <String[]>
      [-ModuleName] <String>
      [-Force]
      [-NoClobberManifest]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

This cmdlet exports an object that can be converted into a function that acts as a proxy for a platform specific command. The resultant module file should be executable down to version 5.1 of PowerShell.

The cmdlet creates both the module .psm1 and the module manifest .psd1 files. This can create problems when you have customized the module manifest beyond the scope of Crescendo. Use the NoClobberManifest parameter to prevent overwriting the manifest.

Examples

EXAMPLE 1

Export-CrescendoModule -ModuleName netsh -ConfigurationFile netsh*.json
Import-Module ./netsh.psm1

EXAMPLE 2

Export-CrescendoModule netsh netsh*.json -force

Parameters

-ConfigurationFile

This is a list of JSON files that represent the proxies for the module.

Type:String[]
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:True

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

By default, if Export-CrescendoModule doesn't overwrite an existing module. Use the Force parameter to overwrite the existing file, or remove it before running Export-CrescendoModule.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ModuleName

The name of the module file you wish to create. You can omit the trailing .psm1.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-NoClobberManifest

Prevents overwriting the module manifest.

You must manually update the manifest with any new cmdlets and settings.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PassThru

Emit an object with the path to the .psm1 and the arguments to New-ModuleManifest.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet isn't run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String[]

Outputs

Object

Notes

Internally, this function calls the Import-CommandConfiguration cmdlet that returns a command object. All files provided in the ConfigurationFile parameter are then used to create each individual function. Finally, all proxies are used to create an Export-ModuleMember command invocation, so when the resultant module is imported, the module has all the command proxies available.

Export-CrescendoModule adds the CrescendoBuilt tag to the module manifest. You can use this tag to find modules in the PowerShell Gallery that were created using Crescendo. For more information, see: