title: powershell create scheduled task without version dependent
body: <p>Am trying to create scheduled task on Windows 2008 R2 with the below method, since this is the method will not depend on any of the powershell version.</p>
  
  <pre><code>$createTask = "schtasks /create /f /tn `"facter`" /tr `"C:\Ruby193\bin\facter.bat -y &gt; C:\mcollective\facts.yaml`" /ru `"NT AUTHORITY\SYSTEM`" /RL HIGHEST /sc daily /st 00:00"
  Invoke-Expression $createTask
  </code></pre>
  
  <p>This task will refresh the mcollective facts yaml file with last information for every 24hours. I have created this task from my AD account login (I have full administrator privilege) and this task has to be run with <code>SYSTEM</code> user account. </p>
  
  <p>But its not running properly and on Last run result column am seeing message as <code>(0x1)</code>.</p>
  
  <p>If I create the same task to run as my AD user account then it runs properly. </p>