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: PowerGUI, PowerPack, PowerShell