Edit

Share via


Export-CrescendoModule

Creates a module from PowerShell Crescendo JSON configuration files

Syntax

Default (Default)

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.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:True
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ModuleName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NoClobberManifest

Prevents overwriting the module manifest.

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PassThru

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

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: