Right. You'll definitely want to be careful with special characters. The whole explanation for others who may view this thread:
Strings are enclosed in single or double quotes in PowerShell. However, the quotes are often optional (such as when providing a string as the value to a parameter) if the string is one word (no spaces), and it doesn't have any special characters. If you need to be sure that special chars aren't parsed, enclose the entire string in single-quotes. There are other cases where you may want to parse some special characters but not others. In that case use the backtick character (`) in front of the special character. Some of those are:
$
[]
{}
`
example:
$pass = 'mypa$$' # good
$pass = mypa$$ # error
$pass = "mypa$$" # not good...double $$ is a reserved variable, so password would be unpredictable
$pass = "mypa`$`$" # good, uses escape character
get-vm -name my$vm # will be interpreted as "my", followed by the contents of the $vm variable
get-vm -name "my$vm" # same
get-vm -name 'my$vm' # will be interpreted as "my$vm" exactly
get-vm -name my`$vm # same
[PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org