title: How to switch current user using powershell?
body: <p>my task is to create new windows local user, log in, using it and then do some actions. Creating new user wasn't a problem but i don't know how to switch current user to new one.</p>
  
  <p>What i did is a piece of script which start new powershell window using new user:</p>
  
  <pre><code>$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
  $mycreds = New-Object System.Management.Automation.PSCredential ($config_name, $secpasswd)
  Start-Process powershell.exe -Credential $mycreds -NoNewWindow
  </code></pre>
  
  <p>Is is possible to start doing rest of the script in this new window??</p>