Introduction

Installing and configuring BizTalk Server is not straightforward, is error prone and can take a lot of time. BizTalk MVPs and experts have created their own installation guides, which are very helpful. This toolkit consists of several PowerShell scripts, which are meant to automate installation and configuration steps.

 Note!
  • This is not yet another installation guide. Use your favorite, and run the scripts in this toolkit as required
  • This guide is intended for professionals who want to automate several BizTalk installations steps. If you don't know the order the scripts should be run, for instance, please learn how to install BizTalk properly before running these scripts. This is not a one-click magical BizTalk installation script

How to Use

  • Download BizTalkInstallationToolkit.zip from TechNet Gallery
  • Copy ZIP-file to BizTalk and SQL servers, and unzip
  • Run scripts in Admin PowerShell console. Make sure PowerShell is not restricted

Details

This section will list all the script in the toolkit, and explain their purpose. All scripts are deliberately designed to do one thing only, to avoid complex error handling. Also, some scripts (like WindowsUpdate.ps1) need to be run several times. The scripts are listed alphabetically:

  • BAM_64bit.ps1
    The BAM portal only runs in 32-bit mode. If you are using Internet Information Services (IIS) in a 64-bit environment, you must set IIS to 32-bit mode to run the BAM portal. Run this script on all BizTalk servers in the group.

    Code
    cscript.exe c:\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1
  • BizTalkWindowsFeatures.ps1
    Several Windows features are required on BizTalk servers. This script will install them, and some optional ones. Run this script on all BizTalk servers in the group. If there are certain features you don't want on your servers, please comment them away in the script.
    Note! If Windows Server installation media is available on your server, comment away lines 2-6.

    Code
    01.# Set Windows installation media path
    02.$AlternateSourcePath = Read-Host("Enter path to installation media (e.g. D:\sources\sxs)")
    03. 
    04.# Create the Servicing Registry Key and LocalSourcePath String Value
    05.New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Servicing -Force
    06.Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Servicing -Name "LocalSourcePath" -Value $AlternateSourcePath -Force
    07. 
    08.Write-Host("")
    09.Write-Host("Installing Windows Features...") -Fore Green
    10. 
    11.# Install required Windows Features
    12.Import-Module ServerManager
    13.Install-WindowsFeature -name FS-FileServer
    14.Install-WindowsFeature -name Storage-Services
    15.Install-WindowsFeature -name Web-Default-Doc
    16.Install-WindowsFeature -name Web-Dir-Browsing
    17.Install-WindowsFeature -name Web-Http-Errors
    18.Install-WindowsFeature -name Web-Static-Content
    19.Install-WindowsFeature -name Web-Http-Logging
    20.Install-WindowsFeature -name Web-Log-Libraries
    21.Install-WindowsFeature -name Web-ODBC-Logging
    22.Install-WindowsFeature -name Web-Request-Monitor
    23.Install-WindowsFeature -name Web-Http-Tracing
    24.Install-WindowsFeature -name Web-Stat-Compression
    25.Install-WindowsFeature -name Web-Dyn-Compression
    26.Install-WindowsFeature -name Web-Filtering
    27.Install-WindowsFeature -name Web-Basic-Auth
    28.Install-WindowsFeature -name Web-Digest-Auth
    29.Install-WindowsFeature -name Web-Windows-Auth
    30. 
    31.Install-WindowsFeature -name Web-App-Dev -IncludeAllSubFeature
    32.Install-WindowsFeature -name Web-Mgmt-Tools -IncludeAllSubFeature
    33. 
    34.Install-WindowsFeature -name NET-Framework-Core
    35.Install-WindowsFeature -name NET-Framework-45-Core
    36.Install-WindowsFeature -name NET-Framework-45-ASPNET
    37.Install-WindowsFeature -name NET-WCF-HTTP-Activation45
    38.Install-WindowsFeature -name NET-WCF-TCP-PortSharing45
    39.Install-WindowsFeature -name RDC
    40.Install-WindowsFeature -name RSAT-AD-PowerShell
    41.Install-WindowsFeature -name RSAT-AD-AdminCenter
    42.Install-WindowsFeature -name RSAT-ADDS-Tools
    43.Install-WindowsFeature -name RSAT-ADLDS
    44.Install-WindowsFeature -name FS-SMB1
    45.Install-WindowsFeature -name PowerShell
    46.Install-WindowsFeature -name PowerShell-V2
    47.Install-WindowsFeature -name PowerShell-ISE
    48.Install-WindowsFeature -name WAS-Process-Model
    49.Install-WindowsFeature -name WAS-Config-APIs
    50.Install-WindowsFeature -name WoW64-Support
  • ComputerName.ps1
    If the computername is longer than 15 characters, BizTalk Configuration will not work. This script will check this for you, and allow you to change the name if required. Reboot is required. Run this script on all BizTalk servers in the group.

    Code
    $computerName = [system.environment]::MachineName
    $computerNameLength = $computerName.length
     
    # Valid computer name
    if ($computerNameLength -lt 16) {
        Write-Host("The computer name is $computerName, which is $computerNameLength characters.") -fore Green
        exit
    }
     
    # Invalid computer name
    else {
        Write-Host("The computer name is $computerName, which is $computerNameLength characters. It must be changed!") -fore Red
     
        $newComputerName = Read-Host("`nPlease enter a new computer name with maximum length of 15 characters")
     
        # New computer name is valid
        if (($newComputerName.Length -lt 16) -and ($newComputerName.Length -gt 0)) {
            try {
                # Domain computer
                if ((gwmi win32_computersystem).partofdomain -eq $true) {
                    $domainName = $env:userdomain + "\"
                    Rename-Computer -NewName $newComputerName -DomainCredential $domainName -Force
     
                # Workgroup computer
                } else {
                    Rename-Computer -NewName $newComputerName -Force
                }
            }
            catch {
                Write-Host("`nRename failed. Please update computer name manually.") -fore Red
                exit
            }
        }
        # New computer name is invalid
        else {
            Write-Host("`nComputer name must be maximum 15 characters. Exiting!") -fore Red
        }
    }
  • DisableIPv6.ps1
    IPv6 is the latest address protocol that will eventually replace IPv4. Windows Server 2012 R2 kept this protocol enabled by default, but it is also a fact that IPv6 is not yet common, and many routers, modems and other network equipment do not support it yet. It may therefore be a wise approach to disable it for now. Also by turning it off, it will facilitate the process of detecting which ports certain application are listening to. This script will list all network IPv6 connections, and allow you to disable connections by name. Run the script several times if necessary. Run this script on all servers.
    Note! This is an optional step. You have to decide if you want to keep IPv6 connections

    Code
    Write-Host("Current IPv6 network connections") -fore Green
    Get-NetAdapterBinding -ComponentID ms_tcpip6
    $netAdapterName = Read-Host("`nWhich IPv6 network name do you want to disable?")
    Disable-NetAdapterBinding -Name $netAdapterName -ComponentID ms_tcpip6
  • DownloadCAB.ps1
    BizTalk relies on diverse products and technologies to provide essential services and features. If not already present, some software that is required by BizTalk is installed on your computer during the BizTalk installation process. For example with BizTalk Server 2013 this software may be installed:
    • Microsoft SQL XML 4.0 with Service Pack 1
    • Microsoft Office Web Components
    • Microsoft ADO MD.Net 9.0
    • Microsoft ADO MD.Net 10.0

    This script will download the correct CAB-file, and put it in the user's Downloads folder. The user is prompted for BizTalk and Windows version. This script only needs to be run once. The CAB-file is used during BizTalk installation.

    Code
    <#
    .SYNOPSIS
    Download BizTalk Server prerequisite CAB-file (English)
    .DESCRIPTION
    This script downloads the prerequisite CAB-file for BizTalk Server. User is prompted for BizTalk and Windows version and bits
    .EXAMPLE
    ./DownloadBizTalkCAB.ps1
    .NOTES
    File will be downloaded in current user's Download folder
    #>
    cls
     
    # Get filename from URL
    function getfilename($source) {
        $pieces=$source.split("/")
        $piecescount=$pieces.Count
        $filename=$pieces[$piecescount-1]
        return $filename
    }
     
    $BTversion = Read-Host("Which BizTalk version are you installing? Enter 2016, 2013R2, 2013, 2010, 2009 or 2006R2")
    $bits = 64
     
    # BizTalk Server 2016
    if ($BTversion -eq "2016") {
        $winversion = Read-Host("Which Windows version are you using? Enter 2016, 2012R2, 10 or 8.1")
        switch ($winversion) {
            "10" { $bits = Read-Host("64 or 32-bit version of Windows? Enter 64 or 32")
                switch ($bits) {
                }
            }
            "8.1" { $bits = Read-Host("64 or 32-bit version of Windows? Enter 64 or 32")
                switch ($bits) {
                }
            }
            default { Write-Host("`nInvalid or unsupported Windows version entered. Exiting") -fore Red
                        exit }
        }
    }
    # BizTalk Server 2013R2
    elseif ($BTversion -eq "2013R2") {
        $winversion = Read-Host("Which Windows version are you using? Enter 2012R2, 2012, 8.1 or 7")
        switch ($winversion) {
            "8.1" { $bits = Read-Host("64 or 32-bit version of Windows? Enter 64 or 32")
                switch ($bits) {
                }
            }
            "7" { $bits = Read-Host("64 or 32-bit version of Windows? Enter 64 or 32")
                switch ($bits) {
                }
            }
            default { Write-Host("`nInvalid or unsupported Windows version entered. Exiting") -fore Red
                        exit }
        }
    }
    # BizTalk Server 2013
    elseif ($BTversion -eq "2013") {
        $winversion = Read-Host("Which Windows version are you using? Enter 2012R2, 2008R2, 8 or 7")
        switch ($winversion) {
            "8" { $bits = Read-Host("64 or 32-bit version of Windows? Enter 64 or 32")
                switch ($bits) {
                }
            }
            "7" { $bits = Read-Host("64 or 32-bit version of Windows? Enter 64 or 32")
                switch ($bits) {
                }
            }
            default { Write-Host("`nInvalid or unsupported Windows version entered. Exiting") -fore Red
                        exit }
        }
    }
    # BizTalk Server 2010
    elseif ($BTversion -eq "2010") {
        $winversion = Read-Host("Which Windows version are you using? Enter 2008R2, 2008, 7 or Vista")
        switch ($winversion) {
            "2008" { $bits = Read-Host("64 or 32-bit version of Windows? Enter 64 or 32")
                switch ($bits) {
                    64 { $source = "" }
                }
            }
            "7" { $bits = Read-Host("64 or 32-bit version of Windows? Enter 64 or 32")
                switch ($bits) {
                }
            }
            "Vista" { $bits = Read-Host("64 or 32-bit version of Windows? Enter 64 or 32")
                switch ($bits) {
                    32 { $source = "" }
                }
            }
            default { Write-Host("`nInvalid or unsupported Windows version entered. Exiting") -fore Red
                        exit }
        }
    }
    # BizTalk Server 2009
    elseif ($BTversion -eq "2009") {
        $winversion = Read-Host("Which Windows version are you using? Enter 2008, 2003, Vista or XP")
        $bits = Read-Host("64 or 32-bit version of Windows? Enter 64 or 32")
        switch ($winversion) {
            "2008" { switch ($bits) {
                    64 { $source = "" }
                 }
            }
            "2003" { switch ($bits) {
                    32 { $source = "" }
                 }
            }
            "Vista" { switch ($bits) {
                    64 { $source = "" }
                    32 { $source = "" }
                 }
            }
            "XP" { switch ($bits) {
                    64 { $source = "" }
                    32 { $source = "" }
                  }
            }
            default { Write-Host("`nInvalid or unsupported Windows version entered. Exiting") -fore Red
                        exit }
        }
    }
    # BizTalk Server 2006R2
    elseif ($BTversion -eq "2006R2") {
        $winversion = Read-Host("Which Windows version are you using? Enter 2003, Vista or XP")
        $bits = Read-Host("64 or 32-bit version of Windows? Enter 64 or 32")
        switch ($winversion) {
            "2003" { switch ($bits) {
                 }
            }
            "Vista" { switch ($bits) {
                 }
            }
            "XP" { switch ($bits) {
                  }
            }
            default { Write-Host("`nInvalid or unsupported Windows version entered. Exiting") -fore Red
                        exit }
        }
    }
    # Invalid Windows version
    else {
        Write-Host("`nInvalid or unsupported Windows version entered. Exiting") -fore Red
        exit
    }
    Write-Host("`nDownloading BizTalk Server $BTversion prerequisite CAB for Windows $winversion - $bits bit edition...") -Fore Green
     
    try {
        # Destination downloadfolder
        $destination = $env:USERPROFILE + "\Downloads\"
        $destination += getfilename $source
     
        # Download CAB-file
        Invoke-WebRequest $source -OutFile $destination
     
        Write-Host("`nFile download complete: " + $destination)
    }
    catch {
        Write-Host("`Download failed. Note that some URLs are not available, check the script source. If the URL is there, verify your Internet connection and try again.") -fore Red
        exit
    }

  • DownloadFiles.ps1
    Several tools and scripts are required (or useful) when configuring a BizTalk server. This includes

    This script will automatically download all these and put them in the user's Downloads folder. This script only needs to be run once.

    Code
    <#
    .SYNOPSIS
    Download BizTalk tools
    .DESCRIPTION
    This script downloads various BizTalk tools from the Internet
    .EXAMPLE
    ./DownloadFiles.ps1
    .NOTES
    File will be downloaded in current user's Download folder
    #>
    cls
     
    # Get filename from URL
    function getfilename($source) {
        $pieces=$source.split("/")
        $piecescount=$pieces.Count
        $filename=$pieces[$piecescount-1]
        return $filename
    }
     
    $url = @()
    $localList = @()
    $fileList = @()
     
    # Array of URLs to tools
     
    # Get all filenames
    for($a=0;$a -lt $url.Count;$a++)
    {
        $fileList += getfilename $url[$a]
    }
     
    # Download all files
    for($b=0;$b -lt $url.Count;$b++)
    {
        $localList += $env:USERPROFILE + "\Downloads\" + $fileList[$b]
        Invoke-Command -scriptblock { Invoke-WebRequest $url[$b] -OutFile $localList[$b] }
    }
  • IIS-App-Pools.ps1
    This script will create one IIS App Pool for SOAP, and another for HTTP. These need to correspond to the Isolated Hosts in BizTalk. The user is prompted for AD-account and password. Run this script on all BizTalk servers running IIS.

    Code
    import-module webadministration
     
    # Get SOAP account details
    $SOAPusername = Read-Host("Please enter domain\username for SOAP app pool")
    $SOAPpassword = Read-Host("Please enter password for SOAP app pool")
     
    Write-Host("")
    Write-Host("Creating BizTalkSOAPAppPool...")  -Fore Green
     
    # Create SOAP app pool
    $SOAPappPoolName = "BizTalkSOAPAppPool"
    New-WebAppPool -Name $SOAPappPoolName -Force
    $SOAPappPool = Get-Item "IIS:\AppPools\$SOAPappPoolName"
    $SOAPappPool.processModel.identityType = 3
    $SOAPappPool.processModel.username = $SOAPusername
    $SOAPappPool.processModel.password = $SOAPpassword
    $SOAPappPool.managedRuntimeVersion = "v4.0"
    $SOAPappPool.managedPipeLineMode = "Integrated"
    $SOAPappPool | Set-Item
     
    # Get HTTP account details
    Write-Host("")
    $HTTPusername = Read-Host("Please enter domain\username for HTTP app pool")
    $HTTPpassword = Read-Host("Please enter password for HTTP app pool")
     
    Write-Host("")
    Write-Host("Creating BizTalkHTTPAppPool...")  -Fore Green
     
    # Create HTTP app pool
    $HTTPappPoolName = "BizTalkHTTPAppPool"
    New-WebAppPool -Name $HTTPappPoolName -Force
    $HTTPappPool = Get-Item "IIS:\AppPools\$HTTPappPoolName"
    $HTTPappPool.processModel.identityType = 3
    $HTTPappPool.processModel.username = $HTTPusername
    $HTTPappPool.processModel.password = $HTTPpassword
    $HTTPappPool.managedRuntimeVersion = "v4.0"
    $HTTPappPool.managedPipeLineMode = "Integrated"
    $HTTPappPool | Set-Item
  • MSDTC.ps1
    MSDTC is the Microsoft Distributed Transaction Coordinator. DTC provides the functionality to ensure complete transactions along with a distributed environment, which means across two or more networked computers. All multi-server installations of BizTalk include setup of MSDTC on the Windows servers. This also includes the SQL server(s). This script is meant for non-clustered installations. For more details about MSDTC in BizTalk installations, see this TechNet Gallery download.

    Code
    <#
    .SYNOPSIS
    Configure local MSDTC for BizTalk
    .DESCRIPTION
    This script configures MSDTC for BizTalk. Requires Windows 8.1/Server 2012 R2 and PowerShell 4.0 or newer
    .EXAMPLE
    ./MSDTC.ps1
    .NOTES
    Run the script on the servers that requires the configuration (BizTalk and SQL)
    #>
    cls
    # Enable MSDTC for Network Access
    Write-Host "Enabling MSDTC for Network Access..." –fore green
     
    try {
        Set-DtcNetworkSetting –DtcName Local –AuthenticationLevel Mutual –InboundTransactionsEnabled 1 –OutboundTransactionsEnabled 1 –RemoteClientAccessEnabled 1 –confirm:$false
     
        Restart-Service MSDTC
     
        Write-Host "`nMSDTC has been configured and restarted"
    }
    catch {
        Write-Host "MSDTC setup failed" -fore red
    }
  • SQLNetworkProtocols.ps1
    Under certain stress conditions (such as clients accessing SQL Server from the same computer), the SQL Server Shared Memory protocol may lower BizTalk Server performance. You can resolve this problem by disabling the use of the Shared Memory network protocol in SQL Server Network Configuration. Also, to facilitate transactions between SQL Server and BizTalk Server, you must enable TCP/IP and Named Pipes in SQL Server. This script will automate this. The user is prompted for SQL instance name. Run the script on the SQL server(s).

    Code
    import-module "sqlps"
    $smo = 'Microsoft.SqlServer.Management.Smo.'
    $wmi = new-object ($smo + 'Wmi.ManagedComputer').
     
    # Get instance
    $InstanceName = [System.String]$Args[0]
    if (!$InstanceName) {
        $InstanceName = Read-Host("Please enter SQL instance name (default is MSSQLSERVER)")
    }
     
    Write-Host("")
    Write-Host("Enabling TCP/IP...")  -Fore Green
     
    # Enable TCP/IP on the instance
    $uri = "ManagedComputer[@Name='" + (get-item env:\computername).Value + "']/ServerInstance[@Name='$InstanceName']/ServerProtocol[@Name='Tcp']"
    $Tcp = $wmi.GetSmoObject($uri)
    $Tcp.IsEnabled = $true
    $Tcp.Alter()
     
    Write-Host("")
    Write-Host("Enabling Named Pipes...")  -Fore Green
     
    # Enable Named Pipes on the instance
    $uri = "ManagedComputer[@Name='" + (get-item env:\computername).Value + "']/ServerInstance[@Name='$InstanceName']/ServerProtocol[@Name='Np']"
    $Np = $wmi.GetSmoObject($uri)
    $Np.IsEnabled = $true
    $Np.Alter()
     
    Write-Host("")
    Write-Host("Disabling Shared Memory....")  -Fore Green
     
    # Disable Shared memory on the instance
    $uri = "ManagedComputer[@Name='" + (get-item env:\computername).Value + "']/ServerInstance[@Name='$InstanceName']/ServerProtocol[@Name='Sm']"
    $Sm = $wmi.GetSmoObject($uri)
    $Sm.IsEnabled = $false
    $Sm.Alter()
     
    Write-Host("")
    Write-Host("Restarting SQL Server service...")  -Fore Green
     
    # Restart SQL Server service
    $service = get-service "$InstanceName" 
    restart-service $service.name -force
     
    C:
  • SQLWindowsFeatures.ps1
    Several Windows features are required on SQL servers as well. This script will install them, and some optional ones. Run this script on all SQL servers. If there are certain features you don't want on your servers, please comment them away in the script.
    Note! If Windows Server installation media is available on your server, comment away lines 2-6.

    Code
    01.# Set Windows installation media path
    02.$AlternateSourcePath = Read-Host("Enter path to installation media (e.g. D:\sources\sxs)")
    03. 
    04.# Create the Servicing Registry Key and LocalSourcePath String Value
    05.New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Servicing -Force
    06.Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Servicing -Name "LocalSourcePath" -Value $AlternateSourcePath -Force
    07. 
    08.Write-Host("")
    09.Write-Host("Installing Windows Features...") -Fore Green
    10. 
    11.# Install required Windows Features
    12.Import-Module ServerManager
    13.Install-WindowsFeature -name FS-FileServer
    14.Install-WindowsFeature -name Storage-Services
    15.Install-WindowsFeature -name NET-Framework-Core
    16.Install-WindowsFeature -name NET-Framework-45-Core
    17.Install-WindowsFeature -name NET-WCF-HTTP-Activation45
    18.Install-WindowsFeature -name NET-WCF-TCP-PortSharing45
    19.Install-WindowsFeature -name RDC
    20.Install-WindowsFeature -name RSAT-SNMP
    21.Install-WindowsFeature -name FS-SMB1
    22.Install-WindowsFeature -name SNMP-WMI-Provider
    23.Install-WindowsFeature -name Telnet-Client
    24.Install-WindowsFeature -name PowerShell
    25.Install-WindowsFeature -name PowerShell-V2
    26.Install-WindowsFeature -name PowerShell-ISE
    27.Install-WindowsFeature -name WoW64-Support
  • StopPrintSpooler.ps1
    Unless you plan to print from your servers, disable the Print Spooler. It is enabled by default and is usually not required. Run this script on all servers.

    Code
    Get-Service Spooler | Stop-Service -PassThru | Set-Service -StartupType disabled
    Write-Host "Print Spooler has been stopped and disabled"
  • UpdateHelp.ps1
    Use this script to update all PowerShell Help files. Run this script on all servers. This task should also be done on a regular basis. For more details about updating PowerShell Help files, see this TechNet Gallery download.

    Code
    Update-Help
  • VerifyInstallation.ps1
    After BizTalk installation, you can verify that everything was installed successfully. This script will check Registry settings and Programs and Features. Run this on all BizTalk servers after installing BizTalk.

    Code
    # Get Registry entires
    Write-Host("Registry entries") -fore Green
    Get-ItemProperty "hklm:\SOFTWARE\Microsoft\BizTalk Server\3.0"
     
    # Get Programs and Features
    Write-Host("Programs and Features") -fore Green
    gwmi -class Win32_Product -Filter "name LIKE 'Microsoft BizTalk%'" | Select -expand Name
  • WindowsFirewall.ps1
    This script will open some Windows Firewall ports required for MSDTC, SQL communication and BizTalk360 (optional). This assumes you use the MSDTC port range Registry settings mentioned in DownloadFiles.ps1, and default ports in SQL Server. If you use other ports, please update the script accordingly. The user is prompted for BizTalk360 ports. Run this script even if Windows Firewall is disabled. Then it will still work if the firewall is enabled later. Run this script on all servers.

    Code
    $BT360 = Read-Host("Do you want to open ports for BizTalk360 (Y/N)?")
     
    Write-Host("")
    Write-Host("Opening and enabling ports for MSDTC and SQL...")  -Fore Green
     
    # Open ports for MSDTC
    New-NetFirewallRule -DisplayName "Allow MSDTC" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 135,5000-5100 | Out-Null
    New-NetFirewallRule -DisplayName "Allow MSDTC" -Direction Outbound -Action Allow -Protocol TCP -LocalPort 135,5000-5100 | Out-Null
     
    # Open ports for SQL
    New-NetFirewallRule -DisplayName "Allow SQL" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 1433-1434 | Out-Null
    New-NetFirewallRule -DisplayName "Allow SQL" -Direction Outbound -Action Allow -Protocol TCP -LocalPort 1433-1434 | Out-Null
     
    # Enable built-in MSDTC ports
    Enable-NetFirewallRule -DisplayName "Distributed Transaction Coordinator (RPC)" | Out-Null
    Enable-NetFirewallRule -DisplayName "Distributed Transaction Coordinator (RPC-EPMAP)" | Out-Null
    Enable-NetFirewallRule -DisplayName "Distributed Transaction Coordinator (TCP-In)" | Out-Null
    Enable-NetFirewallRule -DisplayName "Distributed Transaction Coordinator (TCP-Out)" | Out-Null
     
    if ($BT360.ToUpper() -eq "Y" -or $BT360.ToUpper() -eq "YES") {
        Write-Host("")
        Write-Host("Opening and enabling ports for BizTalk360...")  -Fore Green
     
        # Open ports for BT360
        New-NetFirewallRule -DisplayName "Allow BT360" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 135,1433,50000-50200,445,1164 | Out-Null
        New-NetFirewallRule -DisplayName "Allow BT360" -Direction Outbound -Action Allow -Protocol TCP -LocalPort 135,1433,50000-50200,445,1164 | Out-Null
    }
  • WindowsUpdate.ps1
    This script should be the first thing to be done after installing Windows. It also needs to be run after installing additional software. This script should be run on all servers. If run without parameters, the user is prompted before installing updates. There are two optional parameters - $Install and $Reboot. The first will ensure all updates are installed automatically, the second will automatically reboot the server (if required). Examples
    • ./WindowsUpdate.ps1 Y (automatically install updates)
    • ./WindowsUpdate.ps1 Y Y (automatically install updates, and reboot if required)

    Code
    [cmdletbinding()]
    param(
        [ValidateSet("Y", "Yes", "N", "No")]
        [Parameter(HelpMessage="Automatically install updates?")]
        [STRING]$Install,
        [ValidateSet("Y", "Yes", "N", "No")]
        [Parameter(HelpMessage="Automatically reboot when required?")]
        [STRING]$Reboot
    )
     
    cls
    # Create session and searcher
    $UpdateSession = New-Object -Com Microsoft.Update.Session
    $UpdateSearcher = $UpdateSession.CreateUpdateSearcher()
      
    Write-Host("Searching for new updates...") -Fore Green
      
    $SearchResult = $UpdateSearcher.Search("IsInstalled=0 and Type='Software'")
      
    # List all available updates
    Write-Host("")
    Write-Host("List of available updates:") -Fore Green
     
    For ($X = 0; $X -lt $SearchResult.Updates.Count; $X++){
        $Update = $SearchResult.Updates.Item($X)
        Write-Host( ($X + 1).ToString() + " - " + $Update.Title)
    }
      
    # No updates available
    If ($SearchResult.Updates.Count -eq 0) {
        Write-Host("There are no available updates.")
        Exit
    }
     
    # Updates to download
    $UpdatesToDownload = New-Object -Com Microsoft.Update.UpdateColl
      
    For ($X = 0; $X -lt $SearchResult.Updates.Count; $X++){
        $Update = $SearchResult.Updates.Item($X)
        $Null = $UpdatesToDownload.Add($Update)
    }
     
    # Download updates
    Write-Host("")
    Write-Host("Downloading Updates...")  -Fore Green
      
    $Downloader = $UpdateSession.CreateUpdateDownloader()
    $Downloader.Updates = $UpdatesToDownload
    $Null = $Downloader.Download()
     
    # Updates to install
    $UpdatesToInstall = New-Object -Com Microsoft.Update.UpdateColl
      
    For ($X = 0; $X -lt $SearchResult.Updates.Count; $X++){
        $Update = $SearchResult.Updates.Item($X)
        If ($Update.IsDownloaded) {
            $Null = $UpdatesToInstall.Add($Update)       
        }
    }
      
    If (!$Install){
        $Install = Read-Host("Would you like to install these updates now? (Y/N)")
    }
      
    # Install updates
    If ($Install.ToUpper() -eq "Y" -or $Install.ToUpper() -eq "YES"){
        Write-Host("")
        Write-Host("Installing Updates...") -Fore Green
      
        $Installer = $UpdateSession.CreateUpdateInstaller()
        $Installer.Updates = $UpdatesToInstall
      
        $InstallationResult = $Installer.Install()
      
        Write-Host("")
        Write-Host("List of Installed Updates:") -Fore Green
      
        For ($X = 0; $X -lt $UpdatesToInstall.Count; $X++){
            Write-Host($UpdatesToInstall.Item($X).Title)
            Write-Verbose($UpdatesToInstall.Item($X).Title + ": " + $InstallationResult.GetUpdateResult($X).ResultCode)
        }
      
        Write-Host("")
     
        switch ($InstallationResult.ResultCode)
        {
            0 { Write-Host("Installation Result: Not Started") }
            1 { Write-Host("Installation Result: In Progress") }
            2 { Write-Host("Installation Result: Succeeded") }
            3 { Write-Host("Installation Result: Succeeded With Errors") -Fore Red }
            default { Write-Host("Installation Result: Succeeded") }
        }
         
        Write-Host("Reboot Required: " + $InstallationResult.RebootRequired)
      
        # Reboot required
        If ($InstallationResult.RebootRequire -eq $True){
            If (!$Reboot){
                $Reboot = Read-Host("Would you like to install these updates now? (Y/N)")
            }
      
            If ($Reboot.ToUpper() -eq "Y" -or $Reboot.ToUpper() -eq "YES"){
                Write-Host("")
                Write-Host("Rebooting...") -Fore Green
                (Get-WMIObject -Class Win32_OperatingSystem).Reboot()
            }
        }
    }

See Also

Another important place to find an extensive amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalk Server Resources on the TechNet Wiki.