Dynamically add Server 2008 NLB Nodes

Posted by Nick Jacques on Server Fault See other posts from Server Fault or by Nick Jacques
Published on 2009-11-25T04:17:47Z Indexed on 2010/03/15 0:10 UTC
Read the original article Hit count: 530

Hi All,

I have a small NLB cluster for Terminal Servers. One of the things we're looking at doing for this particular project (this is for a college class) is dynamically creating Terminal Servers.

What we've done is create policies for a certain OU, that sets the proper TS Farm properties and installs the Terminal Server role and NLB feature. Now what we'd like to do is create a script to be run on our Domain Controller to add hosts to the preexisting NLB cluster. On our Server 2008 R2 Domain Controller, I was thinking of running the following PowerShell script I've kind of hacked together.

Any thoughts on if this will work? Is there any way I can trigger this script to run on the DC once all the scripts to install roles are done on the various Terminal Servers?

Thanks very much in advance!!

Import-Module NetworkLoadBalancingClusters

$TermServs = @()
$Interface = "Local Area Connection"

$ou = [ADSI]"LDAP://OU=Term Servs,DC=example,DC=com"
foreach ($child in $ou.psbase.Children)
{
  if ($child.ObjectCategory -like '*computer*') {$TermServs += $child.Name}
}

foreach ($TS in $TermServs)
{
  Get-NlbCluster 172.16.0.254 | Add-NlbClusterNode -NewNodeName $TS -NewNodeInterface $Interface
}

© Server Fault or respective owner

Related posts about windows-server-2008-r2

Related posts about powershell