Spillman to PageGate Service Installation Script

Top  Previous  Next

# This script will install the sp-pg.ps1 script as a windows service

# It must be run with administrator rights

 

# Steps

# 1. Download the NSSM tool from https://nssm.cc

# 2. Update $NssmPath variable value below to point to the nssm executable folder

# 3. Update $PsPath variable value below

# 4. Run this script

# 5. In the Windows Services App, update the logon credentials for this service to

#    use a regular user account, instead of the system account

 

# path to nssm.exe

$NssmPath = "THE PATH TO YOUR SCRIPT'S FOLDER\nssm-2.24\win64\"

 

# path to sp-pg.ps1

$PsPath = "THE PATH TO YOUR SCRIPT'S FOLDER\sp-pg-ps\sp-pg.ps1"

 

# name of service

$ServiceName = “Spillman-PageGate-PowerScript”

 

$NssmCommand = (Get-Command ($NssmPath + "nssm.exe")).Source

 

$PoShCommand = (Get-Command powershell).Source

#alternate for specific path

#$PoShCommand = "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"

$args = '-ExecutionPolicy Bypass -NoProfile -File "{0}"' -f $PsPath

$args

& $NssmCommand install $ServiceName $PoShCommand $args