Adde snippits
This commit is contained in:
14
Windows/CreateScheduledTask.ps1
Normal file
14
Windows/CreateScheduledTask.ps1
Normal file
@@ -0,0 +1,14 @@
|
||||
###############################################################
|
||||
# @description: #
|
||||
# Used to create a new ScheduledTask #
|
||||
# The task will run as System, wil wake up from sleep #
|
||||
# and will run if system is on bateriess #
|
||||
# #
|
||||
# @author: Bram Prieshof #
|
||||
###############################################################
|
||||
|
||||
$action = New-ScheduledTaskAction -Execute <Command> -Argument "<Args>"
|
||||
$trigger = New-ScheduledTaskTrigger -At 18:00 -Daily
|
||||
$options = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -DontStopOnIdleEnd -WakeToRun
|
||||
$principal = New-ScheduledTaskPrincipal -UserId "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest
|
||||
Register-ScheduledTask -TaskName AutoPowerOff -Trigger $trigger -Action $action -Settings $options -Principal $principal
|
||||
Reference in New Issue
Block a user