How to import a Cmdlet from a DLL

Karsten picture Karsten · Jan 11, 2015 · Viewed 8.9k times · Source

Is it possible to import and invoke a Cmdlet from a DLL that is not in the PATH directories?

I want to write a build script with powershell that is able to compress the results. Therefore I found 7Zip4Powershell Cmdlets (Source), but I am unable to invoke them.

Answer

Alan picture Alan · Jan 11, 2015

You can use the Import-Module command to load a PowerShell module. Therefore, you should be able to use:

Import-Module C:\Temp\7Zip4Powershell.dll