test(services): testing remove restart and stop

This commit is contained in:
2025-04-02 21:24:23 -05:00
parent b2683d0429
commit 3355eb389c
7 changed files with 162 additions and 56 deletions

View File

@@ -4,6 +4,7 @@ param (
[string]$appPath,
[string]$command, # just the command like run startadm or what ever you have in npm.
[string]$description
[string]$remote
)
# Example string to run with the parameters in it.
@@ -24,6 +25,16 @@ param (
$nssmPath = $AppPath + "\nssm.exe"
$npmPath = "C:\Program Files\nodejs\npm.cmd" # Path to npm.cmd
if($remote -eq "true"){
$plantFunness = {
param ($service, $processType, $location)
# Call your PowerShell script inside plantFunness
& "$($location)\dist\server\scripts\services.ps1" -serviceName $service -option $processType -appPath $location
}
Invoke-Command -ComputerName $server -ScriptBlock $plantFunness -ArgumentList $service, $option, $appPath -Credential $credentials
}
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Host "Error: This script must be run as Administrator."
exit 1