title: Powershell - Scheduled Tasks, language independence, Win 7+
body: <p>I know there has to be an easy solution to this but I have been searching for two days now with no luck.  </p>
  
  <p><strong>Basic goal:</strong>
  I want to query (and set) the state of <code>Scheduled Defrag</code> using <code>PowerShell</code></p>
  
  <p>Limitations:  Must be able to work when run with the system set to any language, Must  not require installing any additional software, packs, etc (ie clean system), Must be able to run on any system Windows 7+ (ideally even earlier)</p>
  
  <p><strong>Issues:</strong> </p>
  
  <ol>
  <li>I can get the state using <code>'schtasks /query /TN
  '\Microsoft\Windows\Defrag\ScheduledDefrag''</code> but this is <strong>(a)</strong>
  directory language dependent, and more importantly <strong>(b)</strong> returns
  everything as  a string of some sort, meaning state is something
  like <code>'Disabled'</code>.. in English.  But every language returns its own
  word for 'Disabled', in its own character code, meaning hard-coding
  over a hundred languages x the number of options</li>
  <li><code>Windows 7</code> does not recognize <code>Get-ScheduledTask</code> (seems to be
  Win8+), even if it did not sure how to query 'Disabled' as a state
  without using the actual word</li>
  </ol>
  
  <p>I have to be missing something very basic but all I am finding are suggestions to install  Powershell packs, and responses dealing specifically with English.  Any suggestions?</p>