< Back

Import-PSFCmdlet

Sun Jan 19, 2020 6:41 pm

NAME Import-PSFCmdlet



SYNOPSIS

Loads a cmdlet into the current context.





SYNTAX

Import-PSFCmdlet [-Name] <String> [-Type] <Type> [[-HelpFile] <String>] [[-Module] <PSModuleInfo>]

[<CommonParameters>]





DESCRIPTION

Loads a cmdlet into the current context.

This can be used to register a cmdlet during module import, making it easy to have hybrid modules publishing both

cmdlets and functions.

Can also be used to register cmdlets written in PowerShell classes.





PARAMETERS

-Name <String>

The name of the cmdlet to register.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Type <Type>

The type of the class implementing the cmdlet.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-HelpFile <String>

Path to the help XML containing the help for the cmdlet.



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Module <PSModuleInfo>

Module to inject the cmdlet into.



Required? false

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Original Author: Chris Dent

Link: https://www.indented.co.uk/cmdlets-without-a-dll/



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Import-PSFCmdlet -Name Get-Something -Type ([GetSomethingCommand])



Imports the Get-Something cmdlet into the current context.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Import-PSFCmdlet -Name Get-Something -Type ([GetSomethingCommand]) -Module (Get-Module PSReadline)



Imports the Get-Something cmdlet into the PSReadline module.











RELATED LINKS