From 34667f252eecde8efa0134d6d16a44da833af5b1 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Wed, 14 Apr 2021 15:23:22 +0200 Subject: [PATCH] Fixed naming and added task scheduling script --- api/tacticalrmm/scripts/community_scripts.json | 4 ++-- scripts/Win_Add_Task_To_TaskScheduler.ps1 | 6 ++++++ .../{Get_Computer_Users.ps1 => Win_Get_Computer_Users.ps1} | 0 ...etwork_To_Private.ps1 => Win_Set_Network_To_Private.ps1} | 0 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 scripts/Win_Add_Task_To_TaskScheduler.ps1 rename scripts/{Get_Computer_Users.ps1 => Win_Get_Computer_Users.ps1} (100%) rename scripts/{Set_Network_To_Private.ps1 => Win_Set_Network_To_Private.ps1} (100%) diff --git a/api/tacticalrmm/scripts/community_scripts.json b/api/tacticalrmm/scripts/community_scripts.json index c43ccd4d..f33b4a24 100644 --- a/api/tacticalrmm/scripts/community_scripts.json +++ b/api/tacticalrmm/scripts/community_scripts.json @@ -473,7 +473,7 @@ }, { "guid": "57997ec7-b293-4fd5-9f90-a25426d0eb90", - "filename": "Get_Computer_Users.ps1", + "filename": "Win_Get_Computer_Users.ps1", "submittedBy": "https://github.com/tremor021", "name": "Get Computer Users", "description": "Get list of computer users and show which one is enabled", @@ -482,7 +482,7 @@ }, { "guid": "77da9c87-5a7a-4ba1-bdde-3eeb3b01d62d", - "filename": "Set_Network_To_Private.ps1", + "filename": "Win_Set_Network_To_Private.ps1", "submittedBy": "https://github.com/tremor021", "name": "Set Network To Private", "description": "Sets current network type to Private", diff --git a/scripts/Win_Add_Task_To_TaskScheduler.ps1 b/scripts/Win_Add_Task_To_TaskScheduler.ps1 new file mode 100644 index 00000000..f9c3c6c9 --- /dev/null +++ b/scripts/Win_Add_Task_To_TaskScheduler.ps1 @@ -0,0 +1,6 @@ +# Add a task to Task Scheduler + +$Trigger = New-ScheduledTaskTrigger -At 10:00am –Daily # Specify the trigger settings +$User = "NT AUTHORITY\SYSTEM" # Specify the account to run the script +$Action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "YOUR COMMAND HERE" # Specify what program to run and with its parameters +Register-ScheduledTask -TaskName "SomeTaskName" -Trigger $Trigger -User $User -Action $Action -RunLevel Highest –Force # Specify the name of the task \ No newline at end of file diff --git a/scripts/Get_Computer_Users.ps1 b/scripts/Win_Get_Computer_Users.ps1 similarity index 100% rename from scripts/Get_Computer_Users.ps1 rename to scripts/Win_Get_Computer_Users.ps1 diff --git a/scripts/Set_Network_To_Private.ps1 b/scripts/Win_Set_Network_To_Private.ps1 similarity index 100% rename from scripts/Set_Network_To_Private.ps1 rename to scripts/Win_Set_Network_To_Private.ps1