Update SVSTaskGate.ps1
This commit is contained in:
102
SVSTaskGate.ps1
102
SVSTaskGate.ps1
@@ -1,7 +1,24 @@
|
|||||||
### Known issues as of January 5 2025
|
### To Modify of January 5 2025
|
||||||
|
|
||||||
|
|
||||||
|
### set the priority in the js code so it waits for one function to complete before starting the next one
|
||||||
|
### let's start thinking about the write-log -TaskCategory "On-boarding" or "Off-boarding"
|
||||||
|
### need new logo and the RGB color codes form john
|
||||||
### add tweak to set default provider, add to toolkit?
|
### add tweak to set default provider, add to toolkit?
|
||||||
|
### add an "off board" button
|
||||||
|
### add "run tweaks" button
|
||||||
|
### add the .net silent install tweaks to toolkit
|
||||||
|
### for the reg tweak need to do/undo function maybe it should have it own check box list
|
||||||
|
### new tab for client apps?
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################
|
||||||
|
|
||||||
|
### Changes done
|
||||||
|
|
||||||
|
### minor change the the param of install-svsmsp
|
||||||
|
### commented out line 64
|
||||||
|
### moved logo to the left in line 384
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# 1) CREATE A GLOBAL LOG CACHE (NEW)
|
# 1) CREATE A GLOBAL LOG CACHE (NEW)
|
||||||
@@ -54,7 +71,7 @@ if (-not (Get-Command -Name Write-Log -CommandType Function -ErrorAction Silentl
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Write to the PowerShell console
|
# Write to the PowerShell console
|
||||||
Write-Host "$Icon [$Level] [$TaskCategory] $Message (Event ID: $EventID)" -ForegroundColor $Color
|
# Write-Host "$Icon [$Level] [$TaskCategory] $Message (Event ID: $EventID)" -ForegroundColor $Color
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
# 2) ALSO STORE THE LOG IN OUR GLOBAL LOG CACHE (NEW)
|
# 2) ALSO STORE THE LOG IN OUR GLOBAL LOG CACHE (NEW)
|
||||||
@@ -165,7 +182,9 @@ function Install-SVSMSP {
|
|||||||
"Install-CyberQP",
|
"Install-CyberQP",
|
||||||
"Install-RocketCyber",
|
"Install-RocketCyber",
|
||||||
"Install-Splashtop",
|
"Install-Splashtop",
|
||||||
"Install-ThreatLocker"
|
"Install-ThreatLocker",
|
||||||
|
"Install-SVSHelpdesk",
|
||||||
|
"Install-SVSWatchtower"
|
||||||
),
|
),
|
||||||
|
|
||||||
# Log file path
|
# Log file path
|
||||||
@@ -184,7 +203,7 @@ function Install-SVSMSP {
|
|||||||
)
|
)
|
||||||
|
|
||||||
function Perform-Cleanup {
|
function Perform-Cleanup {
|
||||||
Write-LogHybrid -Message "Cleanup mode enabled. Starting cleanup process..." -Level "Info" -LogToEvent -EventID 1502
|
Write-LogHybrid -Message "Cleanup mode enabled. Starting cleanup process..." -Level "Info" -LogToEvent
|
||||||
|
|
||||||
# Step 1: Remove all old modules
|
# Step 1: Remove all old modules
|
||||||
Write-LogHybrid -Message "Starting cleanup of old modules..." -Level "Info" -LogToEvent
|
Write-LogHybrid -Message "Starting cleanup of old modules..." -Level "Info" -LogToEvent
|
||||||
@@ -226,7 +245,7 @@ function Install-SVSMSP {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-LogHybrid -Message "Cleanup process completed successfully." -Level "Success" -LogToEvent -EventID 1510
|
Write-LogHybrid -Message "Cleanup process completed successfully." -Level "Success" -LogToEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
function Perform-ToolkitInstallation {
|
function Perform-ToolkitInstallation {
|
||||||
@@ -236,29 +255,29 @@ function Install-SVSMSP {
|
|||||||
# Step 1: Set Execution Policy
|
# Step 1: Set Execution Policy
|
||||||
$localMachineExecutionPolicy = Get-ExecutionPolicy -Scope LocalMachine
|
$localMachineExecutionPolicy = Get-ExecutionPolicy -Scope LocalMachine
|
||||||
if ($localMachineExecutionPolicy -ne "RemoteSigned") {
|
if ($localMachineExecutionPolicy -ne "RemoteSigned") {
|
||||||
Write-LogHybrid -Message "Setting execution policy to RemoteSigned..." -Level "Warning" -LogToEvent -EventID 1522
|
Write-LogHybrid -Message "Setting execution policy to RemoteSigned..." -Level "Warning" -LogToEvent
|
||||||
try {
|
try {
|
||||||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force
|
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force
|
||||||
Write-LogHybrid -Message "Execution policy set to RemoteSigned successfully." -Level "Success" -LogToEvent -EventID 1513
|
Write-LogHybrid -Message "Execution policy set to RemoteSigned successfully." -Level "Success" -LogToEvent
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-LogHybrid -Message "Failed to set execution policy. Error: $_" -Level "Error" -LogToEvent -EventID 1534
|
Write-LogHybrid -Message "Failed to set execution policy. Error: $_" -Level "Error" -LogToEvent
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Step 2: Ensure NuGet is Installed
|
# Step 2: Ensure NuGet is Installed
|
||||||
if (!(Get-PackageProvider -Name "NuGet" -ErrorAction SilentlyContinue)) {
|
#if (!(Get-PackageProvider -Name "NuGet" -ErrorAction SilentlyContinue)) {
|
||||||
Write-LogHybrid -Message "NuGet package provider not found. Installing..." -Level "Warning" -LogToEvent -EventID 1520
|
# Write-LogHybrid -Message "NuGet package provider not found. Installing..." -Level "Warning" -LogToEvent
|
||||||
try {
|
# try {
|
||||||
Install-PackageProvider -Name "NuGet" -Force -Scope AllUsers -Confirm:$false
|
Install-PackageProvider -Name "NuGet" -Force -Scope AllUsers -Confirm:$false
|
||||||
Write-LogHybrid -Message "NuGet package provider installed successfully." -Level "Success" -LogToEvent -EventID 1514
|
# Write-LogHybrid -Message "NuGet package provider installed successfully." -Level "Success" -LogToEvent
|
||||||
}
|
# }
|
||||||
catch {
|
# catch {
|
||||||
Write-LogHybrid -Message "Failed to install NuGet package provider. Error: $_" -Level "Error" -LogToEvent -EventID 1535
|
# Write-LogHybrid -Message "Failed to install NuGet package provider. Error: $_" -Level "Error" -LogToEvent
|
||||||
return
|
# return
|
||||||
}
|
# }
|
||||||
}
|
#}
|
||||||
|
|
||||||
# Step 3: Register the new repository
|
# Step 3: Register the new repository
|
||||||
Write-LogHybrid -Message "Registering the new repository '$NewRepositoryName'..." -Level "Info" -LogToEvent
|
Write-LogHybrid -Message "Registering the new repository '$NewRepositoryName'..." -Level "Info" -LogToEvent
|
||||||
@@ -282,10 +301,10 @@ function Install-SVSMSP {
|
|||||||
Write-LogHybrid -Message "Failed to install new module '$NewModuleName'. Error: $($_.Exception.Message)" -Level "Error" -LogToEvent
|
Write-LogHybrid -Message "Failed to install new module '$NewModuleName'. Error: $($_.Exception.Message)" -Level "Error" -LogToEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-LogHybrid -Message "Toolkit installation process completed successfully." -Level "Success" -LogToEvent -EventID 1510
|
Write-LogHybrid -Message "Toolkit installation process completed successfully." -Level "Success" -LogToEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-LogHybrid -Message "Install-SVSMSP function started." -Level "Info" -LogToEvent -EventID 1500
|
Write-LogHybrid -Message "Install-SVSMSP function started." -Level "Info" -LogToEvent
|
||||||
|
|
||||||
if ($Cleanup) {
|
if ($Cleanup) {
|
||||||
Perform-Cleanup
|
Perform-Cleanup
|
||||||
@@ -297,7 +316,7 @@ function Install-SVSMSP {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-LogHybrid -Message "No specific mode specified. Defaulting to toolkit installation mode..." -Level "Info" -LogToEvent -EventID 1504
|
Write-LogHybrid -Message "No specific mode specified. Defaulting to toolkit installation mode..." -Level "Info" -LogToEvent
|
||||||
Perform-ToolkitInstallation
|
Perform-ToolkitInstallation
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,7 +391,7 @@ function GetHtmlContent {
|
|||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
.logo-container {
|
.logo-container {
|
||||||
text-align: center;
|
text-align: left;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
background-color: #1e1e1e; /* Matches the background color */
|
background-color: #1e1e1e; /* Matches the background color */
|
||||||
}
|
}
|
||||||
@@ -632,11 +651,13 @@ function GetHtmlContent {
|
|||||||
const n8nPasswordContainer = document.getElementById('n8nPasswordContainer');
|
const n8nPasswordContainer = document.getElementById('n8nPasswordContainer');
|
||||||
const dattoRMMContainer = document.getElementById('DattoRMMContainer');
|
const dattoRMMContainer = document.getElementById('DattoRMMContainer');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
checkboxes.forEach(checkbox => {
|
checkboxes.forEach(checkbox => {
|
||||||
if (checkbox !== selectedCheckbox) {
|
if (checkbox !== selectedCheckbox) {
|
||||||
checkbox.checked = selectedCheckbox.checked;
|
checkbox.checked = selectedCheckbox.checked;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (dattoRMMCheckbox.checked) {
|
if (dattoRMMCheckbox.checked) {
|
||||||
optionsContainer.style.display = 'block';
|
optionsContainer.style.display = 'block';
|
||||||
@@ -649,6 +670,21 @@ function GetHtmlContent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateSelectAllonboard() {
|
||||||
|
const selectAllCheckbox = document.getElementById('selectAllOnboardCheckbox');
|
||||||
|
const checkboxes = document
|
||||||
|
.getElementById('onboardTab')
|
||||||
|
.querySelectorAll('input[type="checkbox"]:not(#selectAllOnboardCheckbox)');
|
||||||
|
|
||||||
|
// If any checkbox is unchecked, uncheck "Select All"
|
||||||
|
selectAllCheckbox.checked = Array.from(checkboxes).every(checkbox => checkbox.checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach the updateSelectAllonboard function to all individual checkboxes
|
||||||
|
document.querySelectorAll('#onboardTab input[type="checkbox"]:not(#selectAllOnboardCheckbox)').forEach(checkbox => {
|
||||||
|
checkbox.addEventListener('change', updateSelectAllonboard);
|
||||||
|
});
|
||||||
|
|
||||||
function toggleOffboardCheckboxes(selectAllCheckbox) {
|
function toggleOffboardCheckboxes(selectAllCheckbox) {
|
||||||
// Get all checkboxes inside the offboardTab container
|
// Get all checkboxes inside the offboardTab container
|
||||||
const checkboxes = document
|
const checkboxes = document
|
||||||
@@ -661,6 +697,22 @@ function GetHtmlContent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function updateSelectAllOffboard() {
|
||||||
|
const selectAllCheckbox = document.getElementById('selectAllOffboardCheckbox');
|
||||||
|
const checkboxes = document
|
||||||
|
.getElementById('offboardTab')
|
||||||
|
.querySelectorAll('input[type="checkbox"]:not(#selectAllOffboardCheckbox)');
|
||||||
|
|
||||||
|
// If any checkbox is unchecked, uncheck "Select All"
|
||||||
|
selectAllCheckbox.checked = Array.from(checkboxes).every(checkbox => checkbox.checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach the updateSelectAllOffboard function to all individual checkboxes
|
||||||
|
document.querySelectorAll('#offboardTab input[type="checkbox"]:not(#selectAllOffboardCheckbox)').forEach(checkbox => {
|
||||||
|
checkbox.addEventListener('change', updateSelectAllOffboard);
|
||||||
|
});
|
||||||
|
|
||||||
function toggleTweaksCheckboxes(selectAllCheckbox) {
|
function toggleTweaksCheckboxes(selectAllCheckbox) {
|
||||||
// Get all checkboxes inside the tweaksTab container
|
// Get all checkboxes inside the tweaksTab container
|
||||||
const checkboxes = document
|
const checkboxes = document
|
||||||
|
|||||||
Reference in New Issue
Block a user