title: Powershell - net use doesn't work with variables
body: <p>I'm trying to get a script running that maps network drives at login. Generally, I use get-content with | convertfrom-stringdata to put my parameters (drive letter and path) in a hash.</p>
  
  <p>My problem is the following:</p>
  
  <pre><code>net use /persistent:no $driveletter $networkpath
  </code></pre>
  
  <p>results with an error. When I replace $networkpath with the actual path (\\server\share\folder), it works.</p>
  
  <p>Does anyone know what to do there? Help is greatly appreciated.
  If any information is missing, I'll add it as soon as I can!</p>
  
  <p>Greetings, </p>
  
  <p>Blaargh</p>
  
  <p><strong>EDIT: more code for better understanding of problem</strong></p>
  
  <pre><code>$hash = get-content C:\temp\file.txt | convertfrom-stringdata
      foreach ($keys in $hash.keys) {
      $hashtwo = $hash.$keys -split ("=")
      net use /persistent:no $hashtwo[1] $hashtwo[0]
  }
  </code></pre>
  
  <p>My textfile looks like this:
  <code>key = \\\\server\\share\\folder =G:</code></p>