Make server unavailable gracefully using Powershell in ARR

Another tidbit for those of us using the ARR framework under IIS.

I've had cause over the last few weeks to manipulate the ARR properties using Powershell. Some of this is covered by the WebFarmSnapIn, but much of it still is not.

Today, I found the missing link for manipulating the entire ARR property schema, and invoking the methods container therein.

Below, is a copy and paste of that forum post in case it ever goes offline.


$mgr = new-object Microsoft.Web.Administration.ServerManager
$conf = $mgr.GetApplicationHostConfiguration()
$section = $conf.GetSection("webFarms")
$webFarms = $section.GetCollection()
$webFarm = $webFarms[0]$servers = $webFarm.GetCollection()
$server = $servers[0]$arr = $server.GetChildElement("applicationRequestRouting")

Simple queries

$counters = $arr.GetChildElement("counters")
We now have everything we need to have some real fun! To get the health status of the server we can do
All the counters can be listed with that
$counters.Attributes | Format-List

Changing state

That is all real cool but we also want to change the health status of a server
$method = $arr.Methods["SetHealthy"]
# $method = $arr.Methods["SetUnhealthy"]
Get the instance of the method
$methodInstance = $method.CreateInstance()
Execute the method
We can also change the state of the server
Get the method we want
$method = $arr.Methods["SetState"]
Get the instance of the method
$methodInstance = $method.CreateInstance()
Set the input value
$methodInstance.Input.Attributes[0].Value = 0
Execute the method
So far I've seen that these input values yields to :
0 -> Available
1 -> Drain
2 -> Unavailable
3 -> Unavailable
2 and 3 yields to Unavailable so I guess one is for "Make Server Unavailable Gracefully" and the other is for Make Server Unavailable Immediately"


  1. Always maintain this in mind, SM카지노 especially should you love enjoying in} slots with progressive jackpots. When you resolve to play wagering video games, you must first establish a gaming price range. This will let you gamble guilt-free end result of|as a outcome of} it is not prudent to squander your cash earlier than your money owed and routine prices are met. Your on line casino price range may also help you in deciding which activities you can to|you presumably can} and can't probably play. Slot machine fans are in luck in terms of|in relation to} on-line casinos {because|as a outcome of|as a outcome of} these video games have the best bonuses. For the very best score, we wish a sweet welcome bonus mixed with reload bonuses, tournaments, jackpots, time-sensitive bonus rounds, free spins, and extra.


Post a Comment