title: PowerShell -replace square brackets?
body: <p>So I recently learn that to remove, say, curly braces with -replace, I need to enclose them in square brackets. Like so:</p>
  
  <pre><code>$server = '{Server123}'
  $server -replace '[{}]',''
  </code></pre>
  
  <p>So then, my mind wondered, how would we remove square brackets?</p>
  
  <pre><code>$server1 = '[Serverxyz]'
  </code></pre>
  
  <p>I've tried escaping with forward slashes, back slashes, using more square brackets, parentheses, curly braces, putting each square bracket into a variable and replacing the variables. </p>
  
  <p>I'm coming up with nothing. I find a couple of online sources for the procedure, but they are for doing the job in Javascript, or C++, or something besides PowerShell.</p>