Skip to content

Instantly share code, notes, and snippets.

@jeroenmaes
Created October 24, 2014 07:28
Show Gist options
  • Save jeroenmaes/a6edb2e3d4f22ae0dd4f to your computer and use it in GitHub Desktop.
Save jeroenmaes/a6edb2e3d4f22ae0dd4f to your computer and use it in GitHub Desktop.
Creating BizTalk Hosts and Host Instances
Function CreateHost($strHostName, $boolIsTrackingHost)
{
Set-Location 'BizTalk:\Platform Settings\Hosts'
New-Item -Path:$strHostName -HostType:'InProcess' -NtGroupName: $DomainName'\BizTalk Application Users' -AuthTrusted:$false
Set-ItemProperty -Path:$strHostName -Name:HostTracking -Value:$boolIsTrackingHost
Set-ItemProperty -Path:$strHostName -Name:Is32BitOnly -Value:$false
Cd \
}
Function CreateHostInstance($strHostName, $Credentials)
{
Set-Location 'BizTalk:\Platform Settings\Host Instances'
New-Item -Path:$strHostName -HostName:$strHostName -RunningServer:$Env:ComputerName -Credentials:$Credentials
Cd \
}
Cd BizTalk:
$PlaintextPassword = '**SuperSecretPassword**'
$DomainName = 'LABO'
$BtsHostUser = $DomainName + '\BTSHostUser'
$arrHostNames = @("ReceiveHost", "SendHost", "ProcessHost", "TrackingHost")
$SecurePassword = ConvertTo-SecureString $PlaintextPassword -AsPlainText -Force
$Credentials = New-Object -TypeName:System.Management.Automation.PSCredential -ArgumentList $BtsHostUser, $SecurePassword
foreach ($hostName in $arrHostNames)
{
$varIsTrackingHost = $false
if($hostName -eq "TrackingHost")
{
$varIsTrackingHost = $true
}
CreateHost -strHostName $hostName -boolIsTrackingHost $varIsTrackingHost
CreateHostInstance -strHostName $hostName -Credentials $Credentials
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment