PowerShellPack - TaskScheduler module - launch a task without logging in

I need to schedule a task through Powershell v2 on Windows Server 2008. I am using the TaskScheduler module from MS PowershellPack .

Scheduling a task is fine, but I need a task to run, even no one is logged in. I saw that this is possible in Powershell v3 on Win8 or Win2k12 ( this QA ). But this is not my business - I need this in Powershell version 2.

Is this possible with the module I'm using? Or is there a workaround?

+2
source share
1 answer

http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357(v=vs.85).aspx

It is not possible to go down in the V2 world, but it will do everything you need and can be called directly from powershell

Edit:

This question made me think, and I realized that your script is a little different from mine, so it should be possible. Therefore, I used to be wrong. It turns out that comobject Scheduler.service is compatible with Powershell 2.0, but also works only with Task Scheduler 2.0. I thought this was not because I was on xp, and Task Scheduler 2.0 was only available in Vista and above.

Looking at the source code of this MS PowershellPack, I found that all it does is use the Scheduler.service com object. https://github.com/sushihangover/SushiHangover-PowerShell/tree/master/modules/TaskScheduler

For a good guide on managing this com object for yourself: https://blogs.technet.microsoft.com/heyscriptingguy/2009/04/01/hey-scripting-guy-how-can-i-best-work-with-task -scheduler /

And the answer to your question: How to set the schedule.service "Run whether the user was enabled or not" in Powershell?

Sorry for misunderstanding. I will not let this happen again: D
In any case, schtasks.exe will cover all your databases, and IMO is easier to work with, because it is one command and does not require Invoke-Session when scheduling a task on a remote server.

+3
source

Source: https://habr.com/ru/post/977488/


All Articles