IIS10 Server Farms Integration

Hi Guys,

Our environment has a IIS Server Farms for Staging environment: this server farm is composed by two server so we need to turn online/offline a single server during deployment pipeline.
Is there a way to command IIS Server Farms in order accomplish this request?

Thank you!

Hi @fabrizio.mancin,

Thanks for the question!

I’ve not done much work with managing IIS Server farms myself, but typically anything that you can do in the IIS Manager can be scripted using a PowerShell Module / cmdlet.

Looking online, it appears Microsoft deprecated the Web Farm Framework 2.0 and rolled it into IIS ARR. That didn’t come with standalone PowerShell cmdlets as with Web Farm Framework 2.0 did.

I found another post on our forum here:

I’d recommend trying out the second option e.g. using a PowerShell run a script step and running the command:

Set-WebConfigurationProperty -Filter ‘/webFarms/webFarm[@name=“MyServerFarm”]/server[@address=“server1.domain.com 1”]’ -Name enabled -Value $false

Disabling a server in the farm is generally better than removing it, as it allows in-flight requests to complete gracefully.

The function Set-WebConfigurationProperty relies on the IIS Web Administration PS-SnapIn / Module.

Before you run the command, you will want to import the module, like this:

try {
	Add-PSSnapin WebAdministration -ErrorAction Stop
} catch {
    try {
		 Import-Module WebAdministration -ErrorAction Stop
		} catch {
			Write-Warning "We failed to load the WebAdministration module. This usually resolved by doing one of the following:"
			Write-Warning "1. Install IIS via Add Roles and Features, Web Server (IIS)"
			Write-Warning "2. Install .NET Framework 3.5.1"
			Write-Warning "3. Upgrade to PowerShell 3.0 (or greater)"
			Write-Warning "4. On Windows 2008 you might need to install PowerShell SnapIn for IIS from http://www.iis.net/downloads/microsoft/powershell#additionalDownloads"
			throw ($error | Select-Object -First 1)

I hope that helps!

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.