test(services): testing remove restart and stop
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user