How can I easily install Windows roles and features on multiple servers?
I recently wanted to create a new 4 node cluster with 4 freshly built servers. Rather than manually run the commands on each server, try this approach.
September 14, 2015
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
About the Author
You May Also Like