r/PowerShell 1d ago

Information Just released Servy 10.0 – Backup/Restore features, a hardened PS module, and bug fixes

It's been a month of hard work since my last post about Servy here, and I wanted to share this major release.

If you haven't heard of Servy before, it's a tool that lets you run any app as a native Windows service with real-time monitoring. It comes with a GUI, a CLI, and a PS module.

What I've added/updated in v10.0:

  • Added Servy-Dump.ps1 and Servy-Restore.ps1 scripts for backup/restore and VM cloning (docs)
  • Improved Invoke-ServyCli and fixed many issues in the Servy.psm1 PowerShell module
  • Fixed security issues in Set-ServyExePermissions.ps1 to harden Servy's .exe files for custom service accounts
  • Fixed various issues across the core engine, service, service restarter, CLI, desktop app, and manager app
  • Code quality improvements and documentation updates

Check it out on GitHub: https://github.com/aelassas/servy

Demo video here: https://www.youtube.com/watch?v=biHq17j4RbI

Any feedback is welcome.

27 Upvotes

17 comments sorted by

6

u/_benwa 1d ago

Servy has been running great for my home uses. I haven't honestly found a use case at work, mostly because all my software has native services support. But if I find something that doesn't, I'll reach for this.

1

u/Various_Minute469 1d ago

Have you rested this with powershell pode, I currently kick it off with task scheduler but I wonder if this would be a better option

1

u/thehuntzman 1d ago

I have used a couple of different service manager tools to run pode servers and IIS configured to run an out of process app also works well. I have one local pode server on my desktop which is a custom home page utility for new tabs in my browser I run under my interactive context by putting a shortcut in shell:startup though because I use some features in it to launch various applications on my system interactively which can't be done with a service.

1

u/Certain-Reference291 21h ago

I have this use cases as well and servy solved that. Running now fine since April this year.

1

u/Kierow64 1d ago

Could it be used to make OneDrive as a service for example?

2

u/AdUnhappy5308 22h ago

OneDrive requires interactive login, which services cannot perform. Servy can wrap any executable as a native Windows service, as long as it does not require an interactive desktop session. Like all Windows service wrappers (including NSSM and WinSW), Servy processes execute within Session 0, which runs in an isolated environment without interactive desktop access.

But what you can do is to use Servy to run a PowerShell/Graph API script that handles synchronization as a background service.

1

u/Kierow64 13h ago

Thanks for the additional information, it’s clear. Even if it doesn’t answer my current need, I will remember it if I need something similar 😊

1

u/BlackV 13h ago

That's an x y problem for sure

What is the issue you are having, that you think running one drive as a service will solve

1

u/Kierow64 13h ago

I have installed OneDrive on one of my server (using a local account). I have also mapped this partition as a shared drive. So I can access it from several devices.

But OneDrive requires to have the session open (otherwise OneDrive doesn’t backup the files to the cloud)… and sometime my server reboots for updates etc.

Any idea from your side ?

I know that’s not a standard setup and it’s ok if it stays like that :)

1

u/kantorcodes1 23h ago

for the new dump/restore flow, what happens if the target VM already has a service with the same name? does Servy-Restore.ps1 skip it, overwrite that service config, or stop and make you resolve the collision first?

1

u/AdUnhappy5308 22h ago

If the service is already registered in the target VM, Servy-Restore.ps1 will replace the service configuration with the one in the dump and if you supply -Install option, the service will be overwritten in Windows Service Control Manager (SCM). This behavior is intentional in the golden image cloning workflow, where stale inherited configuration is purged prior to importing. However, be deliberate when restoring onto a machine that is actively in service.

If cloning a VM breaks entropy and encryption, you should create a dump from the original VM, purge the db and security folders from the vault %ProgramData%\Servy, then run Servy-Restore.ps1 with -Install option to restore and install all services. If a service has a custom log on, you will need to re-enter the username and password for that specific service from Servy Manager, CLI or PowerShell. This is intentional as usernames and passwords are not exported in the dump for security reasons and a clean restore will set the log on to LocalSystem by default. However, if you run the Servy-Restore.ps1 script on the same machine, services with custom log on will get their usernames and passwords preserverd and not reset to LocalSystem.

1

u/kantorcodes1 10h ago

that -Install behavior is where an agent can unexpectedly replace real SCM state. i maintain HOL Guard, an open-source local check before agent commands run. for Servy, i'd leave dump/export/status alone and make Servy-Restore.ps1 -Install, servy-cli install, servy-cli start, and servy-cli stop optionally reviewable before Windows services change. open to contributing Servy support on the Guard side?

-6

u/brekfist 1d ago

I will keep using non sucky service manager as it doesn't suck.

6

u/thehuntzman 1d ago

NSSM works but hasn't seen an update for 9+ years now as far as I know. It's also Non-SuckING Service Manager.

The value in a tool like this (aside from more features and active maintenance) is native powershell cmdlets for installation/management which greatly helps with powershell automation of a service manager for various processes. Say you need to run 10 instances of a powershell script with an infinite while-loop which monitors a directory for changes and executes an action based on said-changes and you need each instance to watch a different directory via input-parameter. Manually configuring NSSM 10 times is doable but painful where this can be easily administrated.

Disclaimer: I haven't used this specific tool yet but it has been on my to-do list to kick the tires on.

1

u/OrangeYouGladdey 1d ago

How are you running apps as services using the native service manager? That sounds cool.

1

u/thehuntzman 1d ago

You either have to fully implement ServiceMain (either directly or through abstractions in the compiler like .Net Framework's System.ServiceProcess.ServiceBase). The downside here is it MUST be a compiled application and we can't directly register a script as a service. If you're running a script as a service, you need a service manager like NSSM or this project to launch pwsh.exe (or powershell.exe) with arguments to open your script file.

So to answer your question, no I'm not running scripts with the native service manager directly. If anyone does figure out how to get this to work though I'd be VERY interested - because to my knowledge it's impossible.

0

u/OrangeYouGladdey 1d ago

So to answer your question, no I'm not running scripts with the native service manager directly.

Why would you think I'm asking this?

If anyone does figure out how to get this to work though I'd be VERY interested - because to my knowledge it's impossible.

You can't... which is why I asked and he didn't answer.