July 3rd, 2013

PowerTip: Import Only Aliases and Functions from a PowerShell Module

Doctor Scripto
Scripter

Summary: Use parameters of Import-Module to control what you import from a Windows PowerShell module.

Hey, Scripting Guy! Question How can I import only custom aliases and functions from a Windows PowerShell module?

Hey, Scripting Guy! Answer 1. Use the –Function and –Alias parameters, and use wildcard characters to control the import (ipmo is an alias for Import-Alias):

ipmo pscx -Function * -Alias *

  2. Use the Get-Command cmdlet to verify the import (gcm is an alias for Get-Command and –mo is short for –Module):

gcm -mo pscx

  Note   For more information about the PSCX module, see Install the PSCX and 80 New Cmdlets to Ease PowerShell Use.

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback