title: How do you set a task to run as the current user at logon using vbs without admin rights?
body: <p>From the command line I can create a scheduled task that runs at logon without the need for admin privileges or the user entering a password to set the task. However I have to use an xml file to do this. here's an example xml, where the "Domain\User" part has to replaced at run time with the domain and name of the current user:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-16"?&gt;
  &lt;Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"&gt;
    &lt;RegistrationInfo&gt;
      &lt;Author&gt;Domain\User&lt;/Author&gt;
    &lt;/RegistrationInfo&gt;
    &lt;Triggers&gt;
      &lt;LogonTrigger&gt;
        &lt;Enabled&gt;true&lt;/Enabled&gt;
        &lt;UserId&gt;Domain\User&lt;/UserId&gt;
      &lt;/LogonTrigger&gt;
    &lt;/Triggers&gt;
    &lt;Principals&gt;
      &lt;Principal id="Author"&gt;
        &lt;UserId&gt;Domain\User&lt;/UserId&gt;
        &lt;LogonType&gt;InteractiveToken&lt;/LogonType&gt;
      &lt;/Principal&gt;
    &lt;/Principals&gt;
    &lt;Settings&gt;
      &lt;DisallowStartIfOnBatteries&gt;false&lt;/DisallowStartIfOnBatteries&gt;
    &lt;/Settings&gt;
    &lt;Actions Context="Author"&gt;
      &lt;Exec&gt;
        &lt;Command&gt;"C:\Windows\notepad.exe"&lt;/Command&gt;
        &lt;Arguments&gt;/logon&lt;/Arguments&gt;
      &lt;/Exec&gt;
    &lt;/Actions&gt;
  &lt;/Task&gt;
  </code></pre>
  
  <p>I can use the xml to create a task using the command:</p>
  
  <pre><code>schtasks /create /TN "Test Logon Task" /XML task.xml
  </code></pre>
  
  <p>This works fine but I'm trying to do the same thing in vbs without the need to write and then load an xml file for the user. I've been trying to adapt the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa381912%28v=vs.85%29.aspx" rel="nofollow">example from MSDN</a> but so far I've not been able to add the task without admin rights or prompting for the user's password.</p>
  
  <p>Does anyone know how to do this?</p>