I want to use the windows_task
resource to create a scheduled task that runs only once a user is logged in. There doesn't seem to be a way to set a schtask this way in the latest version of the resource.
Specifically, when i create the task, it gets set to "at log on of any user" and "run whether user is logged on or not". Even when i specify the user
and password
properties.
Is there a way to use the native resource to create a scheduled task with the "run only when user is logged on" setting?
It may have something to do with being able to set the task principal property, which i don't see exposed in the native resource.
my current code is:
windows_task 'Launcher' do
command 'MyApp.exe'
frequency :on_logon
user <username>
password <password>
action [:create, :enable]
thanks.