Update SVSTaskGate.ps1

This commit is contained in:
2025-01-06 14:52:53 -05:00
parent edc6b828fa
commit 6878c2b0d5

View File

@@ -1,12 +1,5 @@
### Known issues as of January 5 2025 ### Known issues as of January 5 2025
### Install-DattoRMM version 25.1.4 is missing functions you'll need version 25.1.5
### Missing Function in module, are added in 25.1.5
### Install-SVSHelpDesk
### Install SVSWatchtower
### Missing the /installSVSMSPModule in the powershell section
### add tweak to set default provider, add to toolkit? ### add tweak to set default provider, add to toolkit?
@@ -132,9 +125,7 @@ else {
} }
# Example usage of Write-LogHybrid # Example usage of Write-LogHybrid
Write-LogHybrid -Message "This is a test log message. Write-logHybrid" -Level "Info" -TaskCategory "TestCategory" -LogToEvent:$true Write-LogHybrid -Message "Starting SVS TaskGate" -Level "Info" -TaskCategory "SVSTaskGate" -LogToEvent:$true
Write-Log -Message "This is a test log message. Write-log" -Level "Info" -TaskCategory "TestCategory" -LogToEvent:$true
function Install-SVSMSP { function Install-SVSMSP {
param ( param (
@@ -179,17 +170,17 @@ function Install-SVSMSP {
# Log file path # Log file path
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
[string]$LogFilePath = "$env:temp\svstoolkit.log", [string]$LogFilePath = "$env:SVSMSP\svstoolkit.log",
# DRMM API Settings # DRMM API Settings
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
[string]$ApiUrl = "https://example-api-url.com", [string]$ApiUrl,
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
[string]$ApiKey = "YOUR_API_KEY_HERE", [string]$ApiKey,
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
[string]$ApiSecretKey = "YOUR_API_SECRET_HERE" [string]$ApiSecretKey
) )
function Perform-Cleanup { function Perform-Cleanup {
@@ -957,6 +948,28 @@ try {
} }
} }
"/installSVSMSPModule" {
if ($request.HttpMethod -eq "GET") {
try {
Install-SVSMSP -InstallToolkit
$responseString = "Install SVSMSP Module triggered successfully."
$response.StatusCode = 200
} catch {
$responseString = "Error triggering Install SVSMSP Module: $_"
$response.StatusCode = 500
}
} else {
$responseString = "Method not allowed. Use GET."
$response.StatusCode = 405
}
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
$response.ContentType = "text/plain"
$response.ContentLength64 = $buffer.Length
$response.OutputStream.Write($buffer, 0, $buffer.Length)
$response.OutputStream.Close()
}
"/installrmm" { "/installrmm" {
if ($request.HttpMethod -eq "POST") { if ($request.HttpMethod -eq "POST") {
try { try {
@@ -1036,9 +1049,19 @@ try {
"/setSVSPowerplan" { "/setSVSPowerplan" {
if ($request.HttpMethod -eq "GET") { if ($request.HttpMethod -eq "GET") {
Set-SVSPowerPlan
try {
Set-SVSPowerPlan
$responseString = "Setting SVS PowerPlan triggered successfully."
$response.StatusCode = 200
} catch {
$responseString = "Error triggering Setting SVS PowerPlan: $_"
$response.StatusCode = 500
}
} else {
$responseString = "Method not allowed. Use GET."
$response.StatusCode = 405
} }
$responseString = "Install SVS Powerplan triggered."
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString) $buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
$response.ContentType = "text/plain" $response.ContentType = "text/plain"
$response.ContentLength64 = $buffer.Length $response.ContentLength64 = $buffer.Length
@@ -1061,7 +1084,6 @@ try {
$responseString = "Method not allowed. Use GET." $responseString = "Method not allowed. Use GET."
$response.StatusCode = 405 $response.StatusCode = 405
} }
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString) $buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
$response.ContentType = "text/plain" $response.ContentType = "text/plain"
$response.ContentLength64 = $buffer.Length $response.ContentLength64 = $buffer.Length
@@ -1072,9 +1094,18 @@ try {
"/installSplashtop" { "/installSplashtop" {
if ($request.HttpMethod -eq "GET") { if ($request.HttpMethod -eq "GET") {
Install-Splashtop try {
Install-Splashtop
$responseString = "Install Splashtop triggered successfully."
$response.StatusCode = 200
} catch {
$responseString = "Error triggering Install Splashtop: $_"
$response.StatusCode = 500
}
} else {
$responseString = "Method not allowed. Use GET."
$response.StatusCode = 405
} }
$responseString = "Install Splashtop triggered."
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString) $buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
$response.ContentType = "text/plain" $response.ContentType = "text/plain"
$response.ContentLength64 = $buffer.Length $response.ContentLength64 = $buffer.Length
@@ -1084,9 +1115,18 @@ try {
"/installRocketCyber" { "/installRocketCyber" {
if ($request.HttpMethod -eq "GET") { if ($request.HttpMethod -eq "GET") {
Install-RocketCyber try {
} Install-RocketCyber
$responseString = "Install RocketCyber triggered." $responseString = "Install RocketCyber triggered successfully."
$response.StatusCode = 200
} catch {
$responseString = "Error triggering Install RocketCyber: $_"
$response.StatusCode = 500
}
} else {
$responseString = "Method not allowed. Use GET."
$response.StatusCode = 405
}
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString) $buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
$response.ContentType = "text/plain" $response.ContentType = "text/plain"
$response.ContentLength64 = $buffer.Length $response.ContentLength64 = $buffer.Length
@@ -1096,9 +1136,18 @@ try {
"/installThreatLocker" { "/installThreatLocker" {
if ($request.HttpMethod -eq "GET") { if ($request.HttpMethod -eq "GET") {
Install-ThreatLocker try {
} Install-ThreatLocker
$responseString = "Install ThreatLocker triggered." $responseString = "Install ThreatLocker triggered successfully."
$response.StatusCode = 200
} catch {
$responseString = "Error triggering Install ThreatLocker: $_"
$response.StatusCode = 500
}
} else {
$responseString = "Method not allowed. Use GET."
$response.StatusCode = 405
}
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString) $buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
$response.ContentType = "text/plain" $response.ContentType = "text/plain"
$response.ContentLength64 = $buffer.Length $response.ContentLength64 = $buffer.Length
@@ -1108,9 +1157,18 @@ try {
"/installSVSHelpDesk" { "/installSVSHelpDesk" {
if ($request.HttpMethod -eq "GET") { if ($request.HttpMethod -eq "GET") {
Install-SVSHelpDesk try {
} Install-SVSHelpDesk
$responseString = "Install SVSHelpDesk triggered." $responseString = "Install SVSHelpDesk triggered successfully."
$response.StatusCode = 200
} catch {
$responseString = "Error triggering Install SVSHelpDesk: $_"
$response.StatusCode = 500
}
} else {
$responseString = "Method not allowed. Use GET."
$response.StatusCode = 405
}
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString) $buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
$response.ContentType = "text/plain" $response.ContentType = "text/plain"
$response.ContentLength64 = $buffer.Length $response.ContentLength64 = $buffer.Length
@@ -1121,8 +1179,18 @@ try {
"/installSVSWatchtower" { "/installSVSWatchtower" {
if ($request.HttpMethod -eq "GET") { if ($request.HttpMethod -eq "GET") {
Install-SVSWatchtower Install-SVSWatchtower
} try {
$responseString = "Install SVSWatchtower triggered." Install-SVSWatchtower
$responseString = "Install SVSWatchtower triggered successfully."
$response.StatusCode = 200
} catch {
$responseString = "Error triggering Install SVSWatchtower: $_"
$response.StatusCode = 500
}
} else {
$responseString = "Method not allowed. Use GET."
$response.StatusCode = 405
}
$buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString) $buffer = [System.Text.Encoding]::UTF8.GetBytes($responseString)
$response.ContentType = "text/plain" $response.ContentType = "text/plain"
$response.ContentLength64 = $buffer.Length $response.ContentLength64 = $buffer.Length