Blog

Extending PrimalSense for external PowerShell snapins

Getting PrimalSense for a COM object that you didn’t have installed on your development machine is fairly simple: Copy the TLB file (type library) to you machine, associate it to a progid and you are all set.

With PowerShell Cmdlets it is not quite that easy. Say you have to use a snapin that is only available on 64 bit but your development machine (and PrimalScript) are 32 bit. Maybe your snapin only installs on a server OS but not on your new Windows 7 laptop? Since snapins are assemblies and not just data files they may not be able to be loaded outside of their intended environment. So neither PrimalScript nor your local PowerShell may have any way of extracting type information.

But as you may have guessed, we created a way to get PrimalSense for snapins that you don’t even have installed.

We will use Quest’s AD snapin to illustrate the process:

1. On the computer where the snapin is installed and registered, run add-pssnapin to load it:
add-pssnapin Quest.ActiveRoles.admanagement

2. Export the CmdLets in that file into a text file.
get-command -syntax -pssnapin Quest.ActiveRoles.admanagement >PSH.external

3. Copy that text file to your computer and load it into PrimalScript and remove all empty lines.

4. Right click in the file, select Properties… and change the encoding from Unicode to ANSI.

5. Copy the file to the languages folder where PrimalScript is installed (e.g. C:\Program Files\SAPIEN Technologies, Inc\PrimalScript 2009\languages) or merge it with a file of that name that may already exist.

Restart PrimalScript and the Cmdlets should be color coded and you should get PrimalSense as well.

image

You will need PrimalScript 2009 build 621 (5.0.621) at the very least.

We know that this is a very manual process and can be automated more, but we know it is necessary to put it out as soon as possible. We will work to streamline this and make it easier as soon as we can.

We will have a snapin/module exporter and an import function in PrimalScript right after Christmas.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , , , ,

Tags: , , , ,

%d bloggers like this: