title: PowerShell: RunSpace.SessionStateProxy.SetVariable is not setting variable
body: <p><strong>ConsoleApplication:</strong></p>
  
  <pre><code>class Program
  {
      static void Main()
      {
          using (var runSpace = RunspaceFactory.CreateRunspace())
          {
              runSpace.Open();
              runSpace.SessionStateProxy.SetVariable("Var1", "Alex");
              using (var pipeline = runSpace.CreatePipeline("C:\\P.ps1"))
              {
                  pipeline.Invoke();
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>P.ps1</strong></p>
  
  <pre><code>$logFile = "C:\MyLog.txt"
  
  function Write-Log ([string] $message)
  {
      Add-Content -Path $logFile -Value $message
  }
  
  Write-Log "Var1: " + $Var1
  </code></pre>
  
  <p>I expect "Var1: Alex" is written into my log file, but I get "Var1: ".</p>
  
  <p>What did I wrong?</p>
  
  <p>Edit:</p>
  
  <p>My original problem is on the following site: <a href="http://nugetter.codeplex.com/workitem/31555" rel="nofollow">http://nugetter.codeplex.com/workitem/31555</a></p>