Restructured Tasks
This commit is contained in:
parent
4acbb76829
commit
79e1953aba
@ -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
|
||||||
|
|
||||||
|
|||||||
@ -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"
|
||||||
@ -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 (
|
||||||
Loading…
x
Reference in New Issue
Block a user