Me, PowerShell, and BizTalk…

For many years, I’ve been a PowerShell enthusiast exposed to Network
Infrastructure and SQL Server technologies.  Now I’ve become a BizTalk
newbie.  And, with my responsibility as a BizTalk Developer, and I attended a BizTalk Server class online.  For my surprise, in one of the modules, instructor talked about a PowerShell Shell script .  I just hope the script hasn’t scare anyone attending the course.

PowerShell is much easier, and fun work once you start using it.  Try to ignore using cmd.exe, and start using PowerShell.   Try it!!   For example try to execute the BTStask.exe command.

The following sample will save the output console results to a PowerShell variable:

$myBTStask = BTStask.exe ListApps

Notice I’ve create my variable “$MyBTStask”, and now I can  extract some information stored in it.  For example, I only want to list all application information:

$MyBTStask | where{$_ -match '-Appl'}
Executing "BTStask.exe" from the PowerShell Console

Now, you can evolved in this simple script into something more sophisticated.

I’m always looking for ways to help me be productive in my  work environment.  So, I found a couple following CodePlex projects, and PowerShell was included:

BizTalk 2010 Web Console:
PowerShell BizTalk provider:

And, there’s more codeplex BizTalk project out there.  Also, there’s some very thorough BizTalk Training Kits available from Microsoft, include Videos, Labs, and Virtual machines.  But you will to use  Microsoft Hyper-V Virtualization Technology:

BizTalk Server 2010 Developer Training Kit:
BizTalk Server 2010 Administrator Training Kit:

BizTalk Server 2010 ESB Training Kit:

So, in my case I use my laptop with Windows 8 Server w/Hyper-V 3.0 and it works GREAT!!

Now, I’m used to work with SQL Server so it makes sanse to me to  explore the possibilities of using PowerShell to help with my BizTalk  Administration.  So, I can check for my Biztalk table in my SQL Server  local instance in the following way:

## - Listing your local Databases:
$MySQL = New-Object('Microsoft.SqlServer.Management.SMO.Server')
$MySQL.Databases | Select Name, owner, Size | Ft -auto

Also, I could list all my SQL Agent jobs with the following generic PowerShell script:

## - Listing your SQL Agent jobs:
$MySQL = New-Object('Microsoft.SqlServer.Management.SMO.Server')
$MySQL.JobServer.Jobs | Select name, isenabled, lastrundate, lastRunOutcome | ft -auto

As you can see, these little simple oneliners you can give lots of  information about your Biztalk box.  This is all executed on your box  which might bring the question: Can I do execute PowerShell script in  another BizTalk box? And the answer is: YES!! But it all depends if your  IT organization will allow it.

Keep in mind, you need to have the proper permissions to allow you to  access these SQL server box.  In the meantime, if you have your on  Virtual Machine, at least you can practice show management how they can  benefit from using PowerShell.

Happy PowerShelling!!