title: PowerShell move window between desktops
body: <p>I wannt to move a window between desktops.
  Something like this:</p>
  <pre><code>$app  = Start-Process notepad.exe -PassThru
  sleep 1
  $hndl = $app.MainWindowHandle
  
  # Move notepad window to desktop №2
  [DesktopManager]::MoveToDesktop($hndl, 2) # True
  
  # Get the number of desktop, where the app is located now
  [DesktopManager]::GetDesktopWindow($hndl) # 2
  
  #etc...
  </code></pre>
  <p>I have found <a href="https://stackoverflow.com/questions/31983767/how-to-move-a-window-between-desktops-using-powershell-net-on-windows-10">this</a> and <a href="https://stackoverflow.com/questions/32416843/altering-win10-virtual-desktop-behavior/32417530#32417530">this</a>, but I don't understand how to run it via PowerShell.</p>
  <p>Also i have found <a href="https://docs.microsoft.com/ru-ru/windows/win32/api/shobjidl_core/nn-shobjidl_core-ivirtualdesktopmanager?redirectedfrom=MSDN" rel="nofollow noreferrer">this</a>...</p>