Adde snippits

This commit is contained in:
2023-05-21 17:35:15 +02:00
parent 3c508641ad
commit 4f7b8491d8
7 changed files with 397 additions and 0 deletions

View 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