Handling Resources with the BizTalkFactory PowerShell Provider

As part of the latest checkin of our PowerShell provider for BizTalk, I added support for directly adding resources to an application using the builtin New-Item CmdLet.

Syntax:

The syntax for adding a resource is like so:

New-Item [-path] <path-and-name-to-resource>
         -Source[Location] <path-and-name-of-source-item>
         [-ItemType <biztalk-resource-type>]
         [-Destination[Location] <destination-location>]
         [-Overwrite]
         [-GacOnAdd]
         [-GacOnImport]
         [-GacOnInstall]

The New-Item CmdLet takes a path to the resource being created. But, in the case of the provider for BizTalk, the name of the resource is actually synthetized from the item being added, so the name is ignored.

One of the nice thing the provider is doing, is trying to infer the type of resource being added. The provider can accurately detect managed assemblies, BizTalk assemblies and COM components at the moment. Those are resources with types System.Biztalk:Assembly, System.Biztalk:BizTalkAssembly and System.BizTalk:Com respectively.

So, most of the time, you can omit the -ItemType command-line argument.

PS: ..\My Application \> Set-Location Resources
PS: ..\My Application\Resources \> New-Item .\NameIgnored -Source C:\Resource.dll

The following extract of a PowerShell session shows how to add two pipeline component resources as regular managed assemblies and one BizTalk assembly containing two pipelines.

As you see, if we look inside the Pipelines subfolder, we see the two newly added pipelines.

This entry was posted in PowerShell. Bookmark the permalink.