title: Variable in Invoke-WebRequest -Uri path
body: <p>I am trying to pass a MAC Address and code (1,2,3,4) to <code>Invoke-WebRequest</code>.
  Manually the command is working fine, but I am not able to do it via command.</p>
  
  <p>The manual command that works is:</p>
  
  <pre><code>Invoke-WebRequest -Uri https://mywebsite.org/pcconfig/setstate.php?mac=F832E3A2503B"&amp;"state=4
  </code></pre>
  
  <p>Now when I break this up into variable to use with the mac from the machine I do the following.</p>
  
  <pre><code>$LiveMAC = Get-NetAdapter -Physical |
             where Status -eq "Up" |
             Select-Object -ExpandProperty PermanentAddress
  
  $Str1 = "https://mywebsite.org/pcconfig/setstate.php?mac=$LiveMAC"
  $Str2 = $Str1 + '"&amp;"' + 'state=4'
  Invoke-WebRequest -Uri $Str2
  </code></pre>
  
  <p>When I run the above code I do not see errors in red, it seems to process but does not work.</p>
  
  <p>Looking at <code>$Str2</code> I see the below output, which seems correct, but when passing it as above it fails to work.</p>
  
  <pre>
  https://mywebsite.org/pcconfig/setstate.php?mac=F832E3A2503B"&"state=4
  </pre>