Adam Najmanowicz
Adam Najmanowicz

Reputation: 1210

How to add a PSCmdlet or PSSnapin to hosted Powershell runtime without installing the snapin

My scenario is as follows.

Is it possible for me to use the commandlet without going through the installation process?

Upvotes: 2

Views: 683

Answers (2)

Roman Kuzmin
Roman Kuzmin

Reputation: 42033

If your use case is straightforward then it is possible. Please see these question: Hosted PowerShell cannot see Cmdlets in the same Assembly. Several answers there provide different ways, choose one that works better or you like more.

Upvotes: 1

Richard
Richard

Reputation: 108995

If you use PowerShell V2 you can use an unregistered snapin as a binary module.

Import-Module ‹path-to-dll›

add a -passthru to get the PSModuleInfo reference which describes the module.

Upvotes: 0

Related Questions