Create scheduled task on a W10 with snapins
-
Hi,
This is my configuration :
Server :
- Ubuntu 18.04
- list itemFOG Server 1.5.7
Clients :
- Windows 10 20H2
- Fog Client 0.11.16
I’m trying to create scheduled tasks on Windows using Fog Snapins.
Unfortunalely nothing worked.
It tried these both scripts :
Batch (shutdown.bat):
@echo off IF EXIST "C:\Users\AB\Desktop\Extinction_Auto" ( echo "exist" COPY /Y NUL C:\Users\AB\Desktop\done.txt schtasks /create /sc daily /tn "MYTASK-DAILY-20PM" /TR "shutdown /p /s" /ST 20:00 > C:\Users\AB\Desktop\done.txt ) else ( COPY /Y NUL C:\Users\AB\Desktop\notdone.txt )
This Powershell script also (shutdown.ps1):
$trigger = New-ScheduledTaskTrigger -Daily -At 8pm $action = New-ScheduledTaskAction -Execute 'shutdown /p /s' Register-ScheduledTask -Trigger $trigger -Action $action -TaskPath "\" -TaskName "SHUT-DAILY-20PM" > C:\shutdown.txt
None of both worked, using snapin dedicated templates or not.
Both scripts works without any issue if I run them directly on a client.
I found another solution which is to add them in the startup folder of a client, but then I have modify the registery of the client to allow autoadminlogin to apply them.
But modyfiying the registery did not work either, even with a message telling “it’s done”, in fact it’s not. I tried to use PsExec to run commands but it did not worked with the snapins.I’ll take any help or suggestion to apply these scheduled task or a change to the registery.
Many thank in advance.
Proc.
-
@processor you can do bat with -> /ru “System”
schtasks /create /sc daily /tn “MYTASK-DAILY-20PM” /TR “shutdown /p /s” /ST 20:00 /ru “System” > C:\Users\AB\Desktop\done.txt -
@processor said in Create scheduled task on a W10 with snapins:
Both scripts works without any issue if I run them directly on a client.
The fog-client runs as SYSTEM user (as a service) and you cannot compare this to manually running scripts.
-
@processor you can do bat with -> /ru “System”
schtasks /create /sc daily /tn “MYTASK-DAILY-20PM” /TR “shutdown /p /s” /ST 20:00 /ru “System” > C:\Users\AB\Desktop\done.txt -
@luilly23 said in Create scheduled task on a W10 with snapins:
@processor you can do bat with -> /ru “System”
schtasks /create /sc daily /tn “MYTASK-DAILY-20PM” /TR “shutdown /p /s” /ST 20:00 /ru “System” > C:\Users\AB\Desktop\done.txtThanks, that’s what I was searching for !
I did not found in the forum how to make it as valid answer, any idea?