I’m deploying a large cluster at the moment and I wanted to install the Failover Clustering feature to all the machines without logging, doing stuff, logging out, and repeating.  This snippet of PowerShell took me 45 seconds to put together.  The feature is installing on 8 machines (Demo-FS1 to Demo-FS8) while I’m writing this blog post Smile

For ($i = 1; $i -lt 9; $i++)
    Install-WindowsFeature -ComputerName Demo-FS$i Failover-Clustering, RSAT-Clustering

The variable $i starts at 1, is used as part of the computer name that is remotely being updated, and then incremented in the next loop iteration.  The loop ends after the 8th iteration, i.e. the 8th server is updated.

Aint automation be-yoot-eeful?

1 comment so far

Add Your Comment
  1. save yourself some typing with the range operator:

    1..8 | Install-WindowsFeature -ComputerName Demo-FS$_ Failover-Clustering, RSAT-Clustering

Get Adobe Flash player