From 4523a38459127bd4bf63fa489c087f381a21b15d Mon Sep 17 00:00:00 2001 From: Stephan Yelle Date: Wed, 17 Dec 2025 20:47:59 -0500 Subject: [PATCH] Delete module/Samy.Onboarding.ps1 --- module/Samy.Onboarding.ps1 | 143 ------------------------------------- 1 file changed, 143 deletions(-) delete mode 100644 module/Samy.Onboarding.ps1 diff --git a/module/Samy.Onboarding.ps1 b/module/Samy.Onboarding.ps1 deleted file mode 100644 index 221e163..0000000 --- a/module/Samy.Onboarding.ps1 +++ /dev/null @@ -1,143 +0,0 @@ -# Samy.Onboarding.ps1 -# Onboarding HTTP handlers and rename computer - -function Invoke-SetSVSPowerPlan { - param($Context) - - Set-SVSPowerPlan - - Write-LogHybrid "PowerPlan set" Success OnBoard - Send-Text $Context "PowerPlan applied" -} - -function Invoke-InstallSVSMSP { - param($Context) - Write-LogHybrid "HTTP trigger: Invoke-InstallSVSMSP" Info OnBoard - try { - Install-SVSMSP -InstallToolkit - Send-Text $Context "SVSMSP Module installed/updated." - } - catch { - Write-LogHybrid "Error in Install-SVSMSP: $_" Error OnBoard - Send-Text $Context "ERROR: $_" - } -} - -function Invoke-InstallCyberQP { - param($Context) - - Install-CyberQP - - Write-LogHybrid "CyberQP installed" Success OnBoard - Send-Text $Context "CyberQP installed" -} - -function Invoke-InstallThreatLocker { - param($Context) - - Install-ThreatLocker - - Write-LogHybrid "ThreatLocker installed" Success OnBoard - Send-Text $Context "ThreatLocker installed" -} - -function Invoke-InstallRocketCyber { - param($Context) - - Install-RocketCyber - - Write-LogHybrid "RocketCyber installed" Success OnBoard - Send-Text $Context "RocketCyber installed" -} - -function Invoke-InstallHelpDesk { - param($Context) - - Install-svsHelpDesk - - Write-LogHybrid "SVS HelpDesk installed" Success OnBoard - 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)" - } -} - -function Invoke-RenameComputer { - param($Context) - - try { - if ($Context.Request.HttpMethod -ne 'POST') { - $Context.Response.StatusCode = 405 - Send-Text $Context 'Use POST' - return - } - - $rawBody = (New-Object IO.StreamReader $Context.Request.InputStream).ReadToEnd() - if (-not $rawBody) { - $Context.Response.StatusCode = 400 - Send-Text $Context 'Missing request body.' - return - } - - try { - $body = $rawBody | ConvertFrom-Json - } - catch { - $Context.Response.StatusCode = 400 - Send-Text $Context 'Invalid JSON body.' - return - } - - $newName = $body.newName - - if (-not (Test-ComputerName -Name $newName)) { - Write-LogHybrid "RenameComputer: invalid computer name '$newName'." Error OnBoard -LogToEvent - $Context.Response.StatusCode = 400 - Send-JSON $Context @{ - Success = $false - Error = "Invalid computer name. Must be 1-15 characters and use only letters, numbers, and hyphens." - } - return - } - - Write-LogHybrid "RenameComputer: renaming computer to '$newName'." Info OnBoard -LogToEvent - - try { - Rename-Computer -NewName $newName -Force -ErrorAction Stop - } - catch { - Write-LogHybrid "RenameComputer: rename failed: $($_.Exception.Message)" Error OnBoard -LogToEvent - $Context.Response.StatusCode = 500 - Send-JSON $Context @{ - Success = $false - Error = $_.Exception.Message - } - return - } - - Write-LogHybrid "RenameComputer: rename complete, reboot required for new name to apply." Success OnBoard -LogToEvent - - Send-JSON $Context @{ - Success = $true - NewName = $newName - Note = "Rename successful. A reboot is required for the new name to take effect." - } - } - catch { - Write-LogHybrid "Invoke-RenameComputer fatal error: $($_.Exception.Message)" Error OnBoard -LogToEvent - $Context.Response.StatusCode = 500 - Send-Text $Context "Internal error during computer rename." - } -}