While automating a build pipeline, a systems administrator is writing a PowerShell script that must email an HTML report. The body of the email has to span multiple lines, preserve the HTML exactly as typed, and include the value of the $ServerName variable inside the markup. Which line correctly declares the string so that the variable is expanded at runtime?
PowerShell performs variable expansion only in double-quoted strings. A double-quoted here-string (opened with @" and closed with "@ on a new line) behaves like a multi-line double-quoted string, so any $Variable inside it is replaced with the variable's value. A single-quoted here-string (@' ... '@) and a single-quoted string (' ... ') are literal, so \(ServerName would appear verbatim. Escaping the dollar sign with a backtick (`\)) also prevents expansion. Therefore, the only option that meets all three requirements-multi-line, exact formatting, and variable substitution-is the double-quoted here-string.