Search code examples
powershellteamcitywindows-server-2012nlboctopus-deploy

how to write a powershell script for load balancing using NLB


I am doing octopus deployment using team-city on servers that are load balanced. I want to write a powershell script so I can do the load balancing of servers in a powershell predeploy script before octopus deploy a site. Also then want to use post deploy script to put back the server. Any idea how can i write as new to powershell.
using teamcity, octopus, windows server12.

many thanks


Solution

  • You don't mention what load balancing technology you are using, so I am going to assume Windows Network Load Balancing (NLB). There are a collection of cmdlets that can help you control the load balancing state of your server.

    The cmdlets are described here: Network Load Balancing cmdlets in Windows PowerShell

    To use the commandlets you'll need to first import the module.

    Import-Module NetworkLoadBalancingClusters
    

    Then you can see all the commands available to you:

    Get-Command –module NetworkLoadBalancingClusters