How can I easily install Windows roles and features on multiple servers?

How can I easily install Windows roles and features on multiple servers?

Q. How can I easily install Windows roles and features on multiple servers?

A. I recently wanted to create a new 4 node cluster with 4 freshly built servers. Rather than manually run the commands on each server I use the approach below. Note you could easily substitute other functionality for each of the servers. Simply place the server names in the $servers array then update the code in the foreach block to add the features you need.

$servers = "win216tp301","win216tp302","win216tp303","win216tp304"
foreach ($server in $servers)
{
    Install-WindowsFeature -computername $server –Name File-Services, Failover-Clustering –IncludeManagementTools
}

Note you can use the same $servers array to perform other actions such as validating and creating a cluster!

$clusname = "win216tpclus"
Test-Cluster –Node $servers –Include “Storage Spaces Direct”,Inventory,Network,”System Configuration”
New-Cluster –Name $clusname –Node $servers –NoStorage

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish