Convert PowerPack to PowerShell script library

PowerPack library at PowerGUI.org is a great source of PowerShell-based administrative consoles for almost every IT platform out there: from VMware to Hyper-V, from WSUS to Operations Manager, from Facebook to Websphere MQ. They make for awesome GUI administrative experience which you can easily tweak by editing the properties of any node.

However, what if you want to use some of the functionality from a PowerPack from PowerShell command-line or scheduled script? You can open Properties of the node you like and save the code as a PS1 file, or use the Convert-PowerPack2Ps1 script I have just posted.

All you need to do is supply the source PowerPack file name/path and the target ps1 name:

& .\Convert-PowerPack2Ps1.ps1 "ActiveDirectory.powerpack" "AD.ps1"

Then you can simply dot-source the newly created ps1 file:

. .\AD.ps1

Then you can start using the imported functions in your command line:

Get-QADUser 'Dmitry Sotnikov' | MemberofRecursive

Give it a try and let me know what you think.

There’s a bunch of things I want to be adding in the future, like generating more PowerShell style names for the functions, resolving function name conflicts, maybe directly importing packs into PowerShell namespace without intermediary ps1 file, and so on. However, I wanted to share what I had so far rather than keep it private till it becomes perfect.😉

Get the script from poshcode: Convert-PowerPack2Ps1 or find it in PowerGUI Script Editor through Search Online dialog box.

Tags: , ,

1 Response to “Convert PowerPack to PowerShell script library”



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




My Recent Tweets

Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

January 2009
M T W T F S S
« Dec   Feb »
 1234
567891011
12131415161718
19202122232425
262728293031  

%d bloggers like this: