Added Enable-AutoPoweroff
This commit is contained in:
19
InstallTools/Enable-AutoPoweroff.cmd
Normal file
19
InstallTools/Enable-AutoPoweroff.cmd
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
REM #############################################################
|
||||||
|
REM # @description: #
|
||||||
|
REM # Add task to automatically shut down the system at 6PM #
|
||||||
|
REM # #
|
||||||
|
REM # @project: IMGSystTools #
|
||||||
|
REM # @author: Bram Prieshof #
|
||||||
|
REM #############################################################
|
||||||
|
|
||||||
|
NET SESSION >nul 2>&1
|
||||||
|
IF %ERRORLEVEL% EQU 0 (
|
||||||
|
PowerShell.exe "$action = New-ScheduledTaskAction -Execute shutdown -Argument '/s /t 0'; $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"
|
||||||
|
ECHO Auto shutdown enabled
|
||||||
|
PAUSE
|
||||||
|
) ELSE (
|
||||||
|
ECHO Please run this script as administrator
|
||||||
|
PAUSE
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user