title: How can i open an application in specific places on my monitors, with Powershell
body: <p>This is what i have pieced together, and i can't understand why it doesn't work.
  The meaning of the script is that it should open google-chrome, and place it at the right side of the screen.</p>
  <p>I ain't the best at powershell, so i hope that you guys can help me understand why is doesn't work. And help me find a solution.</p>
  <pre><code>$source = @&quot;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Runtime.InteropServices;
  using System.Windows.Forms;
  namespace KeyboardSend
  {
      public class KeyboardSend
      {
          [DllImport(&quot;user32.dll&quot;)]
          public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
          private const int KEYEVENTF_EXTENDEDKEY = 1;
          private const int KEYEVENTF_KEYUP = 2;
          public static void KeyDown(Keys vKey)
          {
              keybd_event((byte)vKey, 0, KEYEVENTF_EXTENDEDKEY, 0);
          }
          public static void KeyUp(Keys vKey)
          {
              keybd_event((byte)vKey, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
          }
      }
  }
  &quot;@
  
  Add-Type -TypeDefinition $source -ReferencedAssemblies &quot;System.Windows.Forms&quot;
  
  Function Win ($Key)
  {
      [KeyboardSend.KeyboardSend]::KeyDown(&quot;LWin&quot;)
      [KeyboardSend.KeyboardSend]::KeyDown(&quot;$Key&quot;)
      [KeyboardSend.KeyboardSend]::KeyUp(&quot;LWin&quot;)
  
  }
  
  
  $chrome = 'C:\Program Files\Google\Chrome\Application\chrome.exe' 
  $url = 'www.google.com'
  &amp; $chrome $url
  
  $wshell = New-Object -ComObject wscript.shell;
  
  [KeyboardSend.KeyboardSend]::KeyDown(&quot;LWin&quot;)
  sleep 1
  $wshell.SendKeys('{RIGHT}')
  
  
  [KeyboardSend.KeyboardSend]::KeyUp(&quot;LWin&quot;)
  </code></pre>