change verbs and fixed function Set-edgesearchengine
This commit is contained in:
149
samy.ps1
149
samy.ps1
@@ -1,4 +1,4 @@
|
|||||||
#region changes to be done
|
#region changes to be done
|
||||||
|
|
||||||
#endregion changes to be done
|
#endregion changes to be done
|
||||||
|
|
||||||
@@ -787,13 +787,13 @@ if (-not [System.Diagnostics.EventLog]::SourceExists('$EventSource')) {
|
|||||||
|
|
||||||
$Global:SamyTasks = @(
|
$Global:SamyTasks = @(
|
||||||
# On-Boarding, left column
|
# On-Boarding, left column
|
||||||
@{ Id='setSVSPowerplan'; Name='setSVSPowerplan'; Label='Set SVS Powerplan'; HandlerFn='Handle-setSVSPowerPlan'; Page='onboard'; Column='left' },
|
@{ Id='setSVSPowerplan'; Name='setSVSPowerplan'; Label='Set SVS Powerplan'; HandlerFn='Invoke-setSVSPowerPlan'; Page='onboard'; Column='left' },
|
||||||
@{ Id='installSVSMSPModule'; Name='installSVSMSPModule'; Label='Install SVSMSP Module'; HandlerFn='Handle-InstallSVSMSP'; Page='onboard'; Column='left' },
|
@{ Id='installSVSMSPModule'; Name='installSVSMSPModule'; Label='Install SVSMSP Module'; HandlerFn='Invoke-InstallSVSMSP'; Page='onboard'; Column='left' },
|
||||||
@{ Id='installCyberQP'; Name='installCyberQP'; Label='Install CyberQP'; HandlerFn='Handle-InstallCyberQP'; Page='onboard'; Column='left' },
|
@{ Id='installCyberQP'; Name='installCyberQP'; Label='Install CyberQP'; HandlerFn='Invoke-InstallCyberQP'; Page='onboard'; Column='left' },
|
||||||
@{ Id='installSVSHelpDesk'; Name='installSVSHelpDesk'; Label='Install SVS HelpDesk'; HandlerFn='Handle-InstallSVSHelpDesk'; Page='onboard'; Column='left' },
|
@{ Id='installSVSHelpDesk'; Name='installSVSHelpDesk'; Label='Install SVS HelpDesk'; HandlerFn='Invoke-InstallSVSHelpDesk'; Page='onboard'; Column='left' },
|
||||||
@{ Id='installThreatLocker'; Name='installThreatLocker'; Label='Install ThreatLocker'; HandlerFn='Handle-InstallThreatLocker'; Page='onboard'; Column='left' },
|
@{ Id='installThreatLocker'; Name='installThreatLocker'; Label='Install ThreatLocker'; HandlerFn='Invoke-InstallThreatLocker'; Page='onboard'; Column='left' },
|
||||||
@{ Id='installRocketCyber'; Name='installRocketCyber'; Label='Install RocketCyber'; HandlerFn='Handle-InstallRocketCyber'; Page='onboard'; Column='left' },
|
@{ Id='installRocketCyber'; Name='installRocketCyber'; Label='Install RocketCyber'; HandlerFn='Invoke-InstallRocketCyber'; Page='onboard'; Column='left' },
|
||||||
@{ Id='installDattoRMM'; Name='installDattoRMM'; Label='Install DattoRMM'; HandlerFn='Handle-InstallDattoRMM'; Page='onboard'; Column='left';
|
@{ Id='installDattoRMM'; Name='installDattoRMM'; Label='Install DattoRMM'; HandlerFn='Invoke-InstallDattoRMM'; Page='onboard'; Column='left';
|
||||||
SubOptions= @(
|
SubOptions= @(
|
||||||
@{ Value='inputVar'; Label='Copy Site Variables' },
|
@{ Value='inputVar'; Label='Copy Site Variables' },
|
||||||
@{ Value='rmm'; Label='Install RMM Agent' },
|
@{ Value='rmm'; Label='Install RMM Agent' },
|
||||||
@@ -804,22 +804,22 @@ if (-not [System.Diagnostics.EventLog]::SourceExists('$EventSource')) {
|
|||||||
|
|
||||||
# On-Boarding, right column (optional bits)
|
# On-Boarding, right column (optional bits)
|
||||||
@{ Id='enableBitLocker'; Name='EnableBitLocker'; Label='Enable BitLocker'; HandlerFn='Set-SVSBitLocker'; Page='onboard'; Column='right' },
|
@{ Id='enableBitLocker'; Name='EnableBitLocker'; Label='Enable BitLocker'; HandlerFn='Set-SVSBitLocker'; Page='onboard'; Column='right' },
|
||||||
@{ Id='setEdgeDefaultSearch';Name='setedgedefaultsearch';Label='Set Edge Default Search'; Tooltip='Will configure Edge to use Google as default search provider'; HandlerFn='set-EdgeDefaultSearchProvider';Page='onboard'; Column='right' },
|
@{ Id='setEdgeDefaultSearch';Name='setedgedefaultsearch';Label='Set Edge Default Search'; Tooltip='Will configure Edge to use Google as default search provider'; HandlerFn='Invoke-SetEdgeDefaultSearchEngine';Page='onboard'; Column='right' },
|
||||||
|
|
||||||
# Off-Boarding
|
# Off-Boarding
|
||||||
@{ Id='offUninstallCyberQP'; Name='offUninstallCyberQP'; Label='Uninstall CyberQP'; HandlerFn='Handle-UninstallCyberQP'; Page='offboard' },
|
@{ Id='offUninstallCyberQP'; Name='offUninstallCyberQP'; Label='Uninstall CyberQP'; HandlerFn='Invoke-UninstallCyberQP'; Page='offboard' },
|
||||||
@{ Id='offUninstallSVSHelpDesk'; Name='offUninstallSVSHelpDesk'; Label='Uninstall SVS HelpDesk'; HandlerFn='Handle-UninstallSVSHelpDesk'; Page='offboard' },
|
@{ Id='offUninstallSVSHelpDesk'; Name='offUninstallSVSHelpDesk'; Label='Uninstall SVS HelpDesk'; HandlerFn='Invoke-UninstallSVSHelpDesk'; Page='offboard' },
|
||||||
@{ Id='offUninstallThreatLocker'; Name='offUninstallThreatLocker'; Label='Uninstall ThreatLocker'; HandlerFn='Handle-UninstallThreatLocker'; Page='offboard' },
|
@{ Id='offUninstallThreatLocker'; Name='offUninstallThreatLocker'; Label='Uninstall ThreatLocker'; HandlerFn='Invoke-UninstallThreatLocker'; Page='offboard' },
|
||||||
@{ Id='offUninstallRocketCyber'; Name='offUninstallRocketCyber'; Label='Uninstall RocketCyber'; HandlerFn='Handle-UninstallRocketCyber'; Page='offboard' },
|
@{ Id='offUninstallRocketCyber'; Name='offUninstallRocketCyber'; Label='Uninstall RocketCyber'; HandlerFn='Invoke-UninstallRocketCyber'; Page='offboard' },
|
||||||
@{ Id='offCleanupSVSMSPModule'; Name='offCleanupSVSMSPModule'; Label='Cleanup SVSMSP Toolkit'; HandlerFn='Handle-CleanupSVSMSP'; Page='offboard' },
|
@{ Id='offCleanupSVSMSPModule'; Name='offCleanupSVSMSPModule'; Label='Cleanup SVSMSP Toolkit'; HandlerFn='Invoke-CleanupSVSMSP'; Page='offboard' },
|
||||||
|
|
||||||
# Tweaks
|
# Tweaks
|
||||||
@{ Id='disableAnimations'; Name='disableAnimations'; Label='Disable Animations'; HandlerFn='Disable-Animations'; Page='tweaks' },
|
@{ Id='disableAnimations'; Name='disableAnimations'; Label='Disable Animations'; HandlerFn='Disable-Animations'; Page='tweaks' },
|
||||||
|
|
||||||
# SVS Apps
|
# SVS Apps
|
||||||
@{ Id='wingetLastpass'; Name='wingetLastpass'; Label='LastPass Desktop App'; HandlerFn='Install-WingetLastPass'; Page='SVSApps' },
|
@{ Id='wingetLastpass'; Name='wingetLastpass'; Label='LastPass Desktop App'; HandlerFn='Install-WingetLastPass'; Page='SVSApps' },
|
||||||
@{ Id='wingetChrome'; Name='wingetChrome'; Label='Google Chrome'; HandlerFn='Handle-InstallChrome'; Page='SVSApps' },
|
@{ Id='wingetChrome'; Name='wingetChrome'; Label='Google Chrome'; HandlerFn='Invoke-InstallChrome'; Page='SVSApps' },
|
||||||
@{ Id='wingetAcrobat'; Name='wingetAcrobat'; Label='Adobe Acrobat Reader (64-bit)'; HandlerFn='Handle-InstallAcrobat'; Page='SVSApps' }
|
@{ Id='wingetAcrobat'; Name='wingetAcrobat'; Label='Adobe Acrobat Reader (64-bit)'; HandlerFn='Invoke-InstallAcrobat'; Page='SVSApps' }
|
||||||
|
|
||||||
)
|
)
|
||||||
Write-LogHybrid "Tasks by page: onboard=$(
|
Write-LogHybrid "Tasks by page: onboard=$(
|
||||||
@@ -1167,7 +1167,7 @@ $jsContent
|
|||||||
#region Handler Stubs
|
#region Handler Stubs
|
||||||
#region HTTP responder helpers
|
#region HTTP responder helpers
|
||||||
|
|
||||||
function Respond-Text {
|
function Send-Text {
|
||||||
param($Context, $Text)
|
param($Context, $Text)
|
||||||
if (-not $Context -or -not $Context.Response) {
|
if (-not $Context -or -not $Context.Response) {
|
||||||
return
|
return
|
||||||
@@ -1179,7 +1179,7 @@ $jsContent
|
|||||||
$Context.Response.OutputStream.Close()
|
$Context.Response.OutputStream.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
function Respond-HTML {
|
function Send-HTML {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory = $true)][object] $Context,
|
[Parameter(Mandatory = $true)][object] $Context,
|
||||||
@@ -1195,7 +1195,7 @@ $jsContent
|
|||||||
$Context.Response.OutputStream.Close()
|
$Context.Response.OutputStream.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
function Respond-JSON {
|
function Send-JSON {
|
||||||
param($Context, $Object)
|
param($Context, $Object)
|
||||||
if (-not $Context -or -not $Context.Response) {
|
if (-not $Context -or -not $Context.Response) {
|
||||||
return
|
return
|
||||||
@@ -1210,7 +1210,7 @@ function Respond-JSON {
|
|||||||
#endregion HTTP responder helpers
|
#endregion HTTP responder helpers
|
||||||
|
|
||||||
#region Datto handlers
|
#region Datto handlers
|
||||||
function Handle-FetchSites {
|
function Invoke-FetchSites {
|
||||||
param($Context)
|
param($Context)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1230,13 +1230,13 @@ function Respond-JSON {
|
|||||||
-OutputFile $OutputFile
|
-OutputFile $OutputFile
|
||||||
|
|
||||||
# 3) Return JSON array of sites
|
# 3) Return JSON array of sites
|
||||||
Respond-JSON $Context $sites
|
Send-JSON $Context $sites
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
# Log the exception and return HTTP 500
|
# Log the exception and return HTTP 500
|
||||||
Write-LogHybrid "Handle-FetchSites error: $($_.Exception.Message)" Error DattoRMM -LogToEvent
|
Write-LogHybrid "Invoke-FetchSites error: $($_.Exception.Message)" Error DattoRMM -LogToEvent
|
||||||
$Context.Response.StatusCode = 500
|
$Context.Response.StatusCode = 500
|
||||||
Respond-Text $Context "Internal server error fetching sites."
|
Send-Text $Context "Internal server error fetching sites."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1244,7 +1244,7 @@ function Respond-JSON {
|
|||||||
|
|
||||||
#region Onboarding handlers
|
#region Onboarding handlers
|
||||||
# On-boarding handlers
|
# On-boarding handlers
|
||||||
function Handle-SetSVSPowerPlan {
|
function Invoke-SetSVSPowerPlan {
|
||||||
param($Context)
|
param($Context)
|
||||||
|
|
||||||
# 1) call into your module
|
# 1) call into your module
|
||||||
@@ -1252,22 +1252,22 @@ function Respond-JSON {
|
|||||||
|
|
||||||
# 2) log & write back a simple text response
|
# 2) log & write back a simple text response
|
||||||
Write-LogHybrid "PowerPlan set" "Success" "OnBoard"
|
Write-LogHybrid "PowerPlan set" "Success" "OnBoard"
|
||||||
Respond-Text $Context "PowerPlan applied"
|
Send-Text $Context "PowerPlan applied"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Handle-InstallSVSMSP {
|
function Invoke-InstallSVSMSP {
|
||||||
param($Context)
|
param($Context)
|
||||||
Write-LogHybrid "HTTP trigger: Handle-InstallSVSMSP" "Info" "OnBoard"
|
Write-LogHybrid "HTTP trigger: Invoke-InstallSVSMSP" "Info" "OnBoard"
|
||||||
try {
|
try {
|
||||||
Install-SVSMSP -InstallToolkit
|
Install-SVSMSP -InstallToolkit
|
||||||
Respond-Text $Context "SVSMSP Module installed/updated."
|
Send-Text $Context "SVSMSP Module installed/updated."
|
||||||
} catch {
|
} catch {
|
||||||
Write-LogHybrid "Error in Install-SVSMSP: $_" "Error" "OnBoard"
|
Write-LogHybrid "Error in Install-SVSMSP: $_" "Error" "OnBoard"
|
||||||
Respond-Text $Context "ERROR: $_"
|
Send-Text $Context "ERROR: $_"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Handle-InstallCyberQP {
|
function Invoke-InstallCyberQP {
|
||||||
param($Context)
|
param($Context)
|
||||||
|
|
||||||
# 1) call into your module
|
# 1) call into your module
|
||||||
@@ -1275,10 +1275,10 @@ function Respond-JSON {
|
|||||||
|
|
||||||
# 2) log & write back a simple text response
|
# 2) log & write back a simple text response
|
||||||
Write-LogHybrid "CyberQP installed" "Success" "OnBoard"
|
Write-LogHybrid "CyberQP installed" "Success" "OnBoard"
|
||||||
Respond-Text $Context "CyberQP installed"
|
Send-Text $Context "CyberQP installed"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Handle-InstallThreatLocker {
|
function Invoke-InstallThreatLocker {
|
||||||
param($Context)
|
param($Context)
|
||||||
|
|
||||||
# 1) call into your module
|
# 1) call into your module
|
||||||
@@ -1286,10 +1286,10 @@ function Respond-JSON {
|
|||||||
|
|
||||||
# 2) log & write back a simple text response
|
# 2) log & write back a simple text response
|
||||||
Write-LogHybrid "ThreatLocker installed" "Success" "OnBoard"
|
Write-LogHybrid "ThreatLocker installed" "Success" "OnBoard"
|
||||||
Respond-Text $Context "ThreatLocker installed"
|
Send-Text $Context "ThreatLocker installed"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Handle-InstallRocketCyber {
|
function Invoke-InstallRocketCyber {
|
||||||
param($Context)
|
param($Context)
|
||||||
|
|
||||||
# 1) call into your module
|
# 1) call into your module
|
||||||
@@ -1297,10 +1297,10 @@ function Respond-JSON {
|
|||||||
|
|
||||||
# 2) log & write back a simple text response
|
# 2) log & write back a simple text response
|
||||||
Write-LogHybrid "RocketCyber installed" "Success" "OnBoard"
|
Write-LogHybrid "RocketCyber installed" "Success" "OnBoard"
|
||||||
Respond-Text $Context "RocketCyber installed"
|
Send-Text $Context "RocketCyber installed"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Handle-InstallSVSHelpDesk {
|
function Invoke-InstallSVSHelpDesk {
|
||||||
param($Context)
|
param($Context)
|
||||||
|
|
||||||
# 1) call into your module
|
# 1) call into your module
|
||||||
@@ -1308,19 +1308,33 @@ function Respond-JSON {
|
|||||||
|
|
||||||
# 2) log & write back a simple text response
|
# 2) log & write back a simple text response
|
||||||
Write-LogHybrid "SVS HelpDesk installed" "Success" "OnBoard"
|
Write-LogHybrid "SVS HelpDesk installed" "Success" "OnBoard"
|
||||||
Respond-Text $Context "SVS HelpDesk installed"
|
Send-Text $Context "SVS HelpDesk installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
function Invoke-SetEdgeDefaultSearchEngine {
|
||||||
|
param($Context)
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-LogHybrid "Configuring Edge default search provider" Info OnBoard
|
||||||
|
set-EdgeDefaultSearchEngine
|
||||||
|
Write-LogHybrid "Edge default search set to Google" Success OnBoard
|
||||||
|
Send-Text $Context "Edge default search provider configured."
|
||||||
|
} catch {
|
||||||
|
Write-LogHybrid "Failed to set Edge default search: $($_.Exception.Message)" Error OnBoard
|
||||||
|
Send-Text $Context "ERROR: $($_.Exception.Message)"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion Onboarding handlers
|
#endregion Onboarding handlers
|
||||||
|
|
||||||
function Handle-InstallDattoRMM {
|
function Invoke-InstallDattoRMM {
|
||||||
param($Context)
|
param($Context)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($Context.Request.HttpMethod -ne 'POST') {
|
if ($Context.Request.HttpMethod -ne 'POST') {
|
||||||
$Context.Response.StatusCode = 405
|
$Context.Response.StatusCode = 405
|
||||||
Respond-Text $Context 'Use POST'
|
Send-Text $Context 'Use POST'
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1339,38 +1353,38 @@ function Respond-JSON {
|
|||||||
-SaveCopy: ($data.checkedValues -contains 'exe')
|
-SaveCopy: ($data.checkedValues -contains 'exe')
|
||||||
|
|
||||||
# 3) Acknowledge to the client
|
# 3) Acknowledge to the client
|
||||||
Respond-Text $Context "Triggered DattoRMM for $($data.Name)"
|
Send-Text $Context "Triggered DattoRMM for $($data.Name)"
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
# Log the exception and return HTTP 500
|
# Log the exception and return HTTP 500
|
||||||
Write-LogHybrid "Handle-InstallDattoRMM error: $($_.Exception.Message)" Error DattoRMM -LogToEvent
|
Write-LogHybrid "Invoke-InstallDattoRMM error: $($_.Exception.Message)" Error DattoRMM -LogToEvent
|
||||||
$Context.Response.StatusCode = 500
|
$Context.Response.StatusCode = 500
|
||||||
Respond-Text $Context "Internal server error during DattoRMM install."
|
Send-Text $Context "Internal server error during DattoRMM install."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Datto handlers
|
#endregion Datto handlers
|
||||||
|
|
||||||
#region App handlers
|
#region App handlers
|
||||||
function Handle-InstallChrome { param($Context)
|
function Invoke-InstallChrome { param($Context)
|
||||||
try {
|
try {
|
||||||
winget install --id=Google.Chrome --silent --accept-package-agreements --accept-source-agreements
|
winget install --id=Google.Chrome --silent --accept-package-agreements --accept-source-agreements
|
||||||
Write-LogHybrid "Installed Google Chrome via winget" Success SVSApps -LogToEvent
|
Write-LogHybrid "Installed Google Chrome via winget" Success SVSApps -LogToEvent
|
||||||
Respond-Text $Context "Chrome installed"
|
Send-Text $Context "Chrome installed"
|
||||||
} catch {
|
} catch {
|
||||||
Write-LogHybrid "Chrome install failed: $($_.Exception.Message)" Error SVSApps -LogToEvent
|
Write-LogHybrid "Chrome install failed: $($_.Exception.Message)" Error SVSApps -LogToEvent
|
||||||
Respond-Text $Context "ERROR: $($_.Exception.Message)"
|
Send-Text $Context "ERROR: $($_.Exception.Message)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Handle-InstallAcrobat { param($Context)
|
function Invoke-InstallAcrobat { param($Context)
|
||||||
try {
|
try {
|
||||||
winget install --id=Adobe.Acrobat.Reader.64-bit --silent --accept-package-agreements --accept-source-agreements
|
winget install --id=Adobe.Acrobat.Reader.64-bit --silent --accept-package-agreements --accept-source-agreements
|
||||||
Write-LogHybrid "Installed Adobe Acrobat Reader (64-bit) via winget" Success SVSApps -LogToEvent
|
Write-LogHybrid "Installed Adobe Acrobat Reader (64-bit) via winget" Success SVSApps -LogToEvent
|
||||||
Respond-Text $Context "Acrobat Reader installed"
|
Send-Text $Context "Acrobat Reader installed"
|
||||||
} catch {
|
} catch {
|
||||||
Write-LogHybrid "Acrobat install failed: $($_.Exception.Message)" Error SVSApps -LogToEvent
|
Write-LogHybrid "Acrobat install failed: $($_.Exception.Message)" Error SVSApps -LogToEvent
|
||||||
Respond-Text $Context "ERROR: $($_.Exception.Message)"
|
Send-Text $Context "ERROR: $($_.Exception.Message)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1378,79 +1392,79 @@ function Handle-InstallAcrobat { param($Context)
|
|||||||
|
|
||||||
#region Offboarding handlers
|
#region Offboarding handlers
|
||||||
|
|
||||||
function Handle-UninstallCyberQP {
|
function Invoke-UninstallCyberQP {
|
||||||
param($Context)
|
param($Context)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Get-Command Uninstall-CyberQP -ErrorAction Stop) {
|
if (Get-Command Uninstall-CyberQP -ErrorAction Stop) {
|
||||||
Uninstall-CyberQP
|
Uninstall-CyberQP
|
||||||
Write-LogHybrid "CyberQP uninstalled" Success OffBoard -LogToEvent
|
Write-LogHybrid "CyberQP uninstalled" Success OffBoard -LogToEvent
|
||||||
Respond-Text $Context "CyberQP uninstalled."
|
Send-Text $Context "CyberQP uninstalled."
|
||||||
} else {
|
} else {
|
||||||
throw "Uninstall-CyberQP cmdlet not found in SVSMSP toolkit."
|
throw "Uninstall-CyberQP cmdlet not found in SVSMSP toolkit."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-LogHybrid "Error uninstalling CyberQP: $($_.Exception.Message)" Error OffBoard -LogToEvent
|
Write-LogHybrid "Error uninstalling CyberQP: $($_.Exception.Message)" Error OffBoard -LogToEvent
|
||||||
Respond-Text $Context "ERROR: $($_.Exception.Message)"
|
Send-Text $Context "ERROR: $($_.Exception.Message)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Handle-UninstallSVSHelpDesk {
|
function Invoke-UninstallSVSHelpDesk {
|
||||||
param($Context)
|
param($Context)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Get-Command Uninstall-SVSHelpDesk -ErrorAction Stop) {
|
if (Get-Command Uninstall-SVSHelpDesk -ErrorAction Stop) {
|
||||||
Uninstall-SVSHelpDesk
|
Uninstall-SVSHelpDesk
|
||||||
Write-LogHybrid "SVS HelpDesk uninstalled" Success OffBoard -LogToEvent
|
Write-LogHybrid "SVS HelpDesk uninstalled" Success OffBoard -LogToEvent
|
||||||
Respond-Text $Context "SVS HelpDesk uninstalled."
|
Send-Text $Context "SVS HelpDesk uninstalled."
|
||||||
} else {
|
} else {
|
||||||
throw "Uninstall-SVSHelpDesk cmdlet not found in SVSMSP toolkit."
|
throw "Uninstall-SVSHelpDesk cmdlet not found in SVSMSP toolkit."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-LogHybrid "Error uninstalling SVS HelpDesk: $($_.Exception.Message)" Error OffBoard -LogToEvent
|
Write-LogHybrid "Error uninstalling SVS HelpDesk: $($_.Exception.Message)" Error OffBoard -LogToEvent
|
||||||
Respond-Text $Context "ERROR: $($_.Exception.Message)"
|
Send-Text $Context "ERROR: $($_.Exception.Message)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Handle-UninstallThreatLocker {
|
function Invoke-UninstallThreatLocker {
|
||||||
param($Context)
|
param($Context)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Get-Command Uninstall-ThreatLocker -ErrorAction Stop) {
|
if (Get-Command Uninstall-ThreatLocker -ErrorAction Stop) {
|
||||||
Uninstall-ThreatLocker
|
Uninstall-ThreatLocker
|
||||||
Write-LogHybrid "ThreatLocker uninstalled" Success OffBoard -LogToEvent
|
Write-LogHybrid "ThreatLocker uninstalled" Success OffBoard -LogToEvent
|
||||||
Respond-Text $Context "ThreatLocker uninstalled."
|
Send-Text $Context "ThreatLocker uninstalled."
|
||||||
} else {
|
} else {
|
||||||
throw "Uninstall-ThreatLocker cmdlet not found in SVSMSP toolkit."
|
throw "Uninstall-ThreatLocker cmdlet not found in SVSMSP toolkit."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-LogHybrid "Error uninstalling ThreatLocker: $($_.Exception.Message)" Error OffBoard -LogToEvent
|
Write-LogHybrid "Error uninstalling ThreatLocker: $($_.Exception.Message)" Error OffBoard -LogToEvent
|
||||||
Respond-Text $Context "ERROR: $($_.Exception.Message)"
|
Send-Text $Context "ERROR: $($_.Exception.Message)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Handle-UninstallRocketCyber {
|
function Invoke-UninstallRocketCyber {
|
||||||
param($Context)
|
param($Context)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Get-Command Uninstall-RocketCyber -ErrorAction Stop) {
|
if (Get-Command Uninstall-RocketCyber -ErrorAction Stop) {
|
||||||
Uninstall-RocketCyber
|
Uninstall-RocketCyber
|
||||||
Write-LogHybrid "RocketCyber uninstalled" Success OffBoard -LogToEvent
|
Write-LogHybrid "RocketCyber uninstalled" Success OffBoard -LogToEvent
|
||||||
Respond-Text $Context "RocketCyber uninstalled."
|
Send-Text $Context "RocketCyber uninstalled."
|
||||||
} else {
|
} else {
|
||||||
throw "Uninstall-RocketCyber cmdlet not found in SVSMSP toolkit."
|
throw "Uninstall-RocketCyber cmdlet not found in SVSMSP toolkit."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-LogHybrid "Error uninstalling RocketCyber: $($_.Exception.Message)" Error OffBoard -LogToEvent
|
Write-LogHybrid "Error uninstalling RocketCyber: $($_.Exception.Message)" Error OffBoard -LogToEvent
|
||||||
Respond-Text $Context "ERROR: $($_.Exception.Message)"
|
Send-Text $Context "ERROR: $($_.Exception.Message)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Handle-CleanupSVSMSP {
|
function Invoke-CleanupSVSMSP {
|
||||||
param($Context)
|
param($Context)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1463,14 +1477,14 @@ function Handle-CleanupSVSMSP {
|
|||||||
Install-SVSMSP -Cleanup
|
Install-SVSMSP -Cleanup
|
||||||
|
|
||||||
Write-LogHybrid "SVSMSP toolkit cleanup complete (module, repo, registry)." Success OffBoard -LogToEvent
|
Write-LogHybrid "SVSMSP toolkit cleanup complete (module, repo, registry)." Success OffBoard -LogToEvent
|
||||||
Respond-Text $Context "SVSMSP toolkit cleanup complete."
|
Send-Text $Context "SVSMSP toolkit cleanup complete."
|
||||||
} else {
|
} else {
|
||||||
throw "Install-SVSMSP function not found in current session."
|
throw "Install-SVSMSP function not found in current session."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-LogHybrid "Error cleaning up SVSMSP toolkit: $($_.Exception.Message)" Error OffBoard -LogToEvent
|
Write-LogHybrid "Error cleaning up SVSMSP toolkit: $($_.Exception.Message)" Error OffBoard -LogToEvent
|
||||||
Respond-Text $Context "ERROR: $($_.Exception.Message)"
|
Send-Text $Context "ERROR: $($_.Exception.Message)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1713,7 +1727,7 @@ function Install-DattoRMM {
|
|||||||
# ---- Shutdown handler ----
|
# ---- Shutdown handler ----
|
||||||
if ($path -eq 'quit') {
|
if ($path -eq 'quit') {
|
||||||
Write-LogHybrid "Shutdown requested" "Info" "Server" -LogToEvent
|
Write-LogHybrid "Shutdown requested" "Info" "Server" -LogToEvent
|
||||||
Respond-Text $Context "Server shutting down."
|
Send-Text $Context "Server shutting down."
|
||||||
# stop the listener loop
|
# stop the listener loop
|
||||||
$Global:Listener.Stop()
|
$Global:Listener.Stop()
|
||||||
return
|
return
|
||||||
@@ -1721,7 +1735,7 @@ function Install-DattoRMM {
|
|||||||
|
|
||||||
# ---- Fetch Sites endpoint ----
|
# ---- Fetch Sites endpoint ----
|
||||||
if ($Context.Request.HttpMethod -eq 'POST' -and $path -eq 'getpw') {
|
if ($Context.Request.HttpMethod -eq 'POST' -and $path -eq 'getpw') {
|
||||||
Handle-FetchSites $Context
|
Invoke-FetchSites $Context
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1729,7 +1743,7 @@ function Install-DattoRMM {
|
|||||||
if ($path -in @('', 'onboard', 'offboard', 'tweaks', 'SVSApps')) {
|
if ($path -in @('', 'onboard', 'offboard', 'tweaks', 'SVSApps')) {
|
||||||
$page = if ($path -eq '') { 'onboard' } else { $path }
|
$page = if ($path -eq '') { 'onboard' } else { $path }
|
||||||
$html = Get-UIHtml -Page $page
|
$html = Get-UIHtml -Page $page
|
||||||
Respond-HTML $Context $html
|
Send-HTML $Context $html
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1742,7 +1756,7 @@ function Install-DattoRMM {
|
|||||||
|
|
||||||
# ---- 404 ----
|
# ---- 404 ----
|
||||||
$Context.Response.StatusCode = 404
|
$Context.Response.StatusCode = 404
|
||||||
Respond-Text $Context '404 - Not Found'
|
Send-Text $Context '404 - Not Found'
|
||||||
}
|
}
|
||||||
#endregion Dispatch-Request
|
#endregion Dispatch-Request
|
||||||
|
|
||||||
@@ -1907,3 +1921,4 @@ function Install-DattoRMM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user