Friday, 24 February 2012 10:14

How to Change user credentials of a BizTalk Host Instance with PowerShell

Written by 
Rate this item
(3 votes)

Following my last two posts, I will now demonstrate how we can create a script that allows us to automatically change user credentials of a BizTalk Host Instance.

In a first approach you might think that it would be enough to change the credentials associated with BizTalk service using the following script:

sc.exe config "Service Name" obj= "DOMAIN\User" password= "password"

However if we do this, we will obtain configuration inconsistencies between the services and settings in BizTalk administration console, as you can see in the picture:

host-instances-credenciais

What might cause unforeseen errors. So, to change user credentials of BizTalk Host Instances we need to follow a different approach.


To Change user credentials of a BizTalk Host Instance

//Getting the list of BizTalk Host Instances objects
$hosts = Get-WmiObject MSBTS_HostInstance -namespace 'root/MicrosoftBizTalkServer'

//Listing existing BizTalk Host Instances names
$hosts | ft HostName

//Getting/Filter the desired instance
$MyHost = $hosts | ?{$_.HostName -eq "BizTalkDemoApplication"}

//Change BizTalk Host Instance user credentials
$MyHost.Install("DOMAIN\User", "password", "true")

Or simply

$hostApp = gwmi -n 'root/MicrosoftBizTalkServer' -q 'select * from MSBTS_HostInstance where HostName="BiztalkDemoApplication"'

$hostApp..Install("DOMAIN\User", "password", "true")

Read 2702 times Last modified on Friday, 24 February 2012 10:37
Sandro Pereira

Sandro Pereira lives in Portugal and works as a BizTalk consultant at DevScope. In the last few years has been working implementing integration scenarios and Cloud Provisioning at a major telecommunications service provider in Portugal. His main focus is on Integration Technologies where is been using .NET, BizTalk and SOAP/XML/XSLT since 2002.

He is an active blogger, member of BizTalk Brazil Community, member and moderator of MSDN BizTalk Server Forums, Code Gallery contributor and was awarded Most Valuable Professional (MVP) for BizTalk Server by Microsoft since 2011. He has certifications for BizTalk Server 2006 and BizTalk Server 2010.

twitterlinkedin

Website: sandroaspbiztalkblog.wordpress.com/

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.