Help with formatting

I’m trying to automate a standard web server install on 2012 r2. I’m using add-windows feature to install a long list of features/Roles. What is the best way to format without using ’ (backtick) to make it easily readable and simple to add/remove items should the default build change?


add-WindowsFeature web-server, Web-Default-Doc, Web-Http-Errors, `
Web-Static-Content,Web-Http-Redirect, Web-Http-Logging, Web-Request-Monitor, `
Web-Stat-Compression, Web-Basic-Auth, Web-Windows-Auth, Web-Net-Ext, Web-Net-Ext45, `
Web-AppInit, Web-ASP, Web-Asp-Net, Web-Asp-Net45, Web-CGI, Web-ISAPI-Ext, Web-ISAPI-Filter, `
Web-IP-Security, Web-CGI, Web-ISAPI-Ext,Web-ISAPI-Filter, Web-Mgmt-Console, Web-Mgmt-Compat, `
Web-Metabase, Web-Scripting-Tools, Telnet-Client, Migration

One, try just omitting the backtick. After a comma, the shell will usually look for the next piece of data. Or, define the string as an array first, and then pass the array (in a variable) to the parameter.

I like the array method:

$features = @("Web-Server",

Add-WindowsFeature -Name $features -IncludeManagementTools

Here’s what I’ve been using:

Get-Content .\IIS.txt | % { Install-WindowsFeature -Name $_ }
and I attached the IIS.txt file I use. It lists the IIS features I'd like to see in a standard IIS build..