# README
psServiceWrapper is a golang wrapper that can run your powershell scripts as services. To use it, you will need the Go compiler.
You should update main.ps1
and service.json
in the custom folder. Fill in a name and description for your service in service.json
. These will show up in the windows service manager. Your script goes in main.ps1
. Unfortunately you can't put other powershell scripts in this folder, so you need to put all the logic for your script in one file. The program will exit when your script does, so your script should probably include a loop. When your script exits, our wrapper will exit, but it might be restarted by windows depending on how you set up your service.
NOTE: if your script contains tabs, they will be replaced with spaces to prevent auto-complete from triggering. Normally this is fine, but if you have string literals that contain tabs it can break your scripts.
Once you have your script and service.json
in place, you can compile your program by running
go build
This should result in an EXE. You can run it as:
psServiceWrapper.exe install
: register the service with WindowspsServiceWrapper.exe uninstall
: unregister the servicepsServiceWrapper.exe start
: start the already installed servicepsServiceWrapper.exe stop
: stop the servicepsServiceWrapper.exe restart
: restart the servicepsServiceWrapper.exe test
: run the program in non-service mode, showing outputpsServiceWrapper.exe show
: dump powershell source codepsServiceWrapper.exe
: run the program in non-service mode, hide output