Change user credentials of a BizTalk Host Instance with PowerShell

Posted: February 24, 2012 in BizTalk, PowerShell
Tags: , ,

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.

To change user credentials of BizTalk Host Instances we need to follow a different approach.

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")

Tags: BizTalk | PowerShell | Hosts

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s