2
0

Restructured Tasks

This commit is contained in:
bschaper 2025-01-21 11:04:54 -06:00
parent 4acbb76829
commit 79e1953aba
5 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
$newTaskName = "System_Tasks" $newTaskName = "System-Tasks"
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-File C:\Scripts\Patches\Tasks\System_Tasks.ps1" $action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-File C:\Scripts\Tasks\Run-System-Tasks.ps1"
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -RunLevel Highest $principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -RunLevel Highest
$trigger = New-ScheduledTaskTrigger -AtLogon $trigger = New-ScheduledTaskTrigger -AtLogon

View File

@ -1,5 +1,5 @@
# Specify the directory containing the scripts # Specify the directory containing the scripts
$scriptDirectory = "C:\Scripts\Login\System_Tasks" $scriptDirectory = "C:\Scripts\Tasks\System-Tasks"
# Get all Batch scripts in the directory # Get all Batch scripts in the directory
$scriptsToRun = Get-ChildItem -Path $scriptDirectory -Filter "*.bat" $scriptsToRun = Get-ChildItem -Path $scriptDirectory -Filter "*.bat"

View File

@ -1,5 +1,5 @@
@echo off @echo off
for /f "tokens=*" %%a in ('type "C:\Scripts\Login\System_Tasks\local_admins.txt"') do ( for /f "tokens=*" %%a in ('type "C:\Scripts\Tasks\System-Tasks\users.txt"') do (
for %%b in (%%a) do ( for %%b in (%%a) do (
net localgroup Administrators "%%b" /add net localgroup Administrators "%%b" /add
if errorlevel 1 ( if errorlevel 1 (