-
-
Notifications
You must be signed in to change notification settings - Fork 88
Servy PowerShell Module
The Servy PowerShell Module Servy.psm1 allows you to manage Windows services easily using PowerShell. You can install, start, stop, restart, export/import configurations, check service status, show help, display the version, and uninstall services.
Once you install Servy, the Servy PowerShell module is available at:
%ProgramFiles%\Servy\Servy.psm1
The PowerShell module is compatible with PowerShell 2.0+, Windows 7+ and Windows Server 2008+. If Servy is installed, the module will automatically locate the CLI executable. For the portable version of Servy, place the module Servy.psm1 in the same folder as servy-cli.exe The module will automatically detect and use the local executable.
You can find detailed examples of how to use it here.
Important: If you face any issues with the PowerShell module in automated or non-interactive environments (e.g., CI/CD, Ansible, WinRM), use -Quiet option to suppress interactive output such as spinners or loading animations.
Import the module in your PowerShell session:
Import-Module "C:\Program Files\Servy\Servy.psm1" -ForceDisplay the version:
Show-ServyVersion -QuietDisplay help:
Show-ServyHelpInstall-ServyService `
-Quiet `
-Name "WexflowServer" `
-Description "Wexflow Workflow Engine" `
-Path "C:\Program Files\dotnet\dotnet.exe" `
-StartupDir "C:\Program Files\Wexflow Server\Wexflow.Server" `
-Params "Wexflow.Server.dll" `
-StartupType "Automatic"Export-ServyServiceConfig `
-Quiet `
-Name "WexflowServer" `
-ConfigFileType "xml" `
-Path "C:\WexflowServer.xml"
Export-ServyServiceConfig `
-Quiet `
-Name "WexflowServer" `
-ConfigFileType "json" `
-Path "C:\WexflowServer.json"Import-ServyServiceConfig `
-Quiet `
-ConfigFileType "xml" `
-Path "C:\WexflowServer.xml" `
-Install
Import-ServyServiceConfig `
-Quiet `
-ConfigFileType "json" `
-Path "C:\WexflowServer.json"Start-ServyService -Quiet -Name "WexflowServer"
Get-ServyServiceStatus -Quiet -Name "WexflowServer"
Stop-ServyService -Quiet -Name "WexflowServer"
Restart-ServyService -Quiet -Name "WexflowServer"Uninstall-ServyService -Quiet -Name "WexflowServer"| Cmdlet | Parameters | Description |
|---|---|---|
Install-ServyService |
-Name (string, required)-Path (string, required)-DisplayName (string, optional)-Description (string, optional)-StartupDir (string, optional)-Params (string, optional)-StartupType (string, optional: Automatic, AutomaticDelayedStart, Manual, Disabled)-Priority (string, optional: Idle, BelowNormal, Normal, AboveNormal, High, RealTime)-Stdout (string, optional)-Stderr (string, optional)-StartTimeout (string, optional)-StopTimeout (string, optional)-EnableSizeRotation (switch, optional)-RotationSize (string, optional)-EnableDateRotation (switch, optional)-DateRotationType (string, optional: Daily, Weekly, Monthly)-MaxRotations (string, optional)-EnableHealth (switch, optional)-HeartbeatInterval (string, optional)-MaxFailedChecks (string, optional)-RecoveryAction (string, optional: None, RestartService, RestartProcess, RestartComputer)-MaxRestartAttempts (string, optional)-FailureProgramPath (string, optional)-FailureProgramStartupDir (string, optional)-FailureProgramParams (string, optional)-Env (string, optional)-Deps (string, optional)-User (string, optional)-Password (string, optional)-PreLaunchPath (string, optional)-PreLaunchStartupDir (string, optional)-PreLaunchParams (string, optional)-PreLaunchEnv (string, optional)-PreLaunchStdout (string, optional)-PreLaunchStderr (string, optional)-PreLaunchTimeout (string, optional)-PreLaunchRetryAttempts (string, optional)-PreLaunchIgnoreFailure (switch, optional)-PostLaunchPath (string, optional)-PostLaunchStartupDir (string, optional)-PostLaunchParams (string, optional)-EnableDebugLogs (switch, optional)-Quiet (switch, optional) |
Installs a new Windows service with advanced configuration. Wraps the Servy CLI install command to turn any executable into a managed Windows service. It supports complex lifecycle management, logging, and self-healing features.Key Features: • Logging: Redirect output to files with rotation by size or date. • Health: Automated recovery actions (e.g., RestartService) based on failed heartbeats.• Lifecycle: Execute tasks before ( PreLaunch) or after (PostLaunch) startup.Examples: • Install-ServyService -Name "MyApp" -Path "C:\App\app.exe"• Install-ServyService -Name "LogApp" -Path "C:\App\app.exe" -EnableSizeRotation -RotationSize 10• Install-ServyService -Name "SecureApp" -Path "C:\App\app.exe" -Env "API_KEY=12345;DB_PORT=5432"
|
Uninstall-ServyService |
-Name (string, required)-Quiet (switch, optional) |
Uninstalls a Windows service by name. Completely removes the service entry from the Windows Service Control Manager (SCM) and the Servy internal database. Example: • Uninstall-ServyService -Name "MyApp" -Quiet
|
Start-ServyService |
-Name (string, required)-Quiet (switch, optional) |
Starts a Windows service. Triggers the service start signal. If any PreLaunch settings were defined during installation, the pre-launch process will be executed and must succeed before the main service starts (unless PreLaunchIgnoreFailure was used).Example: • Start-ServyService -Name "MyApp"
|
Stop-ServyService |
-Name (string, required)-Quiet (switch, optional) |
Stops a Windows service. Sends a termination signal to the service process. It respects the StopTimeout value set during installation, allowing the application to shut down gracefully before forcing termination.Example: • Stop-ServyService -Name "MyApp" -Quiet
|
Restart-ServyService |
-Name (string, required)-Quiet (switch, optional) |
Restarts a Windows service. Performs a full stop operation followed by a start operation. This is the recommended way to apply configuration changes after an import. Example: • Restart-ServyService -Name "MyApp"
|
Get-ServyServiceStatus |
-Name (string, required)-Quiet (switch, optional) |
Retrieves the current status of the service. Queries the SCM for the real-time state of the process. Possible Results: Stopped, StartPending, Running, StopPending, Paused.Example: • Get-ServyServiceStatus -Name "MyApp"
|
Export-ServyServiceConfig |
-Name (string, required)-ConfigFileType (string, required: xml, json)-Path (string, required)-Quiet (switch, optional) |
Exports the service configuration to a file. Saves all metadata (paths, timeouts, health checks, etc.) to an external file for backup or template creation. Examples: • Export-ServyServiceConfig -Name "MyApp" -ConfigFileType "json" -Path "C:\Backups\MyApp.json"• Export-ServyServiceConfig -Name "MyApp" -ConfigFileType "xml" -Path "C:\Backups\MyApp.xml"
|
Import-ServyServiceConfig |
-ConfigFileType (string, required: xml, json)-Path (string, required)-Install (switch, optional)-Quiet (switch, optional) |
Imports a configuration from a file. Loads settings from a previously exported file into the Servy database. Use the -Install switch to register the service with Windows immediately after import.Examples: • Import-ServyServiceConfig -ConfigFileType "json" -Path "C:\Configs\NewApp.json" -Install• Import-ServyServiceConfig -ConfigFileType "xml" -Path "C:\Configs\NewApp.xml"
|
Show-ServyHelp |
-Command (string, optional)-Quiet (switch, optional) |
Displays the Servy CLI help manual. Provides global usage instructions or detailed parameter explanations for a specific command if requested. Examples: • Show-ServyHelp• Show-ServyHelp -Command "install"
|
Show-ServyVersion |
-Quiet (switch, optional) |
Displays the version of the Servy binary. Outputs the version string of the servy-cli.exe file being utilized by the module.Example: • Show-ServyVersion -Quiet
|
Copyright © Akram El Assas. All rights reserved.
- Home
- Overview
- Installation Guide
- Advanced Configuration
- Usage
- Servy Desktop App
- Servy Manager
- Servy CLI
- PowerShell Module
- Examples & Recipes
- Logging & Log Rotation
- Health Monitoring & Recovery
- Environment Variables
- Service Dependencies
- Pre-Launch & Post-Launch Actions
- Pre-Stop & Post-Stop Actions
- Shutdown & Teardown
- Export/Import Services
- Automation & CI/CD
- Integration with Monitoring Tools
- Service Event Notifications
- Comparison with Alternatives
- Security
- Architecture
- Building from Source
- Troubleshooting
- FAQ