Now that we’ve discussed how to work with scripts, let’s look at common elements you’ll use in scripts, including
Most scripts begin with comments that specify what a script is for and how it is used. PowerShell supports two types of comments:
Single-line comments that begin with #. PowerShell interprets everything from the begin-comment mark to the end of the line as a comment. Here is an example:
$myVar = "$env:computername" #Get the computer name
Because values in strings are interpreted differently and # is not interpreted as a special character in a string, you can use # in single-quoted and double-quoted ...