title: Kill specific powershell window
body: <p>I am trying to end a powershell window I spawned from a task running as SYSTEM. I don't have the ID of the process since I am launching it through psexec to be able to set the session id. The task and the target powershell process are in different sessions.</p>
  
  <p>I thought it would be simple just to set a window title and then query on the window title but I am running to issues since processes running under the system don't seem to see the window title. For example when I run <code>get-process powershell | format-table -property Name, MainWindowTitle</code> as a user I get:</p>
  
  <pre><code>Name            MainWindowTitle
  ----            ---------------
  powershell      Administrator: C:\Windows\System32\cmd.exe
  powershell      My Title 
  powershell
  </code></pre>
  
  <p>By when I run the same command under the system account I get:</p>
  
  <pre><code>Name            MainWindowTitle
  ----            ---------------
  powershell
  powershell
  powershell
  </code></pre>
  
  <p>I am not sure what is going on here. Is there a way to get the <code>MainWindowTitle</code> from the SYSTEM account? If not, is there something else I could query for that would return my powershell window and leave any other powershell processes running? </p>
  
  <p>I am on Window 7 x64</p>
  
  <pre><code>Name                           Value
  ----                           -----
  CLRVersion                     2.0.50727.5477
  BuildVersion                   6.1.7601.17514
  PSVersion                      2.0
  WSManStackVersion              2.0
  PSCompatibleVersions           {1.0, 2.0}
  SerializationVersion           1.1.0.1
  PSRemotingProtocolVersion      2.1
  </code></pre>