PowerShell Service Template

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 4 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
DavidSunter
Posts: 7
Last visit: Tue Aug 15, 2023 3:05 am

PowerShell Service Template

Post by DavidSunter »

Product, version and build: PowerShell Studio 2019 5.6.161
32 or 64 bit version of product: 64 bit
Operating system: Windows 10 1709 16299.1087
32 or 64 bit OS: 64 bit

I'm testing out the Service template, and simply taking the default template, adding a single Write-Host "Test" line within Startup.pss as such:
  1. if($global:bServicePaused -eq $false) #Only act if service is not paused
  2. {
  3.     Write-Host "Test"
  4. }
I then package the file using the PowerShell V5 Host (Windows Service) script engine
After packaging, I install the service via an elevated PowerShell window and can see the service via the Services console. The service starts successfully, however, nothing is ever written to the Application event log as expected.

I have searched this forum and found the following post from a year ago that had the same issue, although I'm not sure if a resolution was ever found:
viewtopic.php?f=12&t=12423

I have attached the demo project I have tested with if it helps.
Attachments
DemoServiceProject.zip
(140.02 KiB) Downloaded 123 times
User avatar
Olga_B
Site Admin
Posts: 196
Last visit: Thu Mar 28, 2024 8:34 am

Re: PowerShell Service Template

Post by Olga_B »

The issue has been sent to the proper place for evaluation and correction.
User avatar
Olga_B
Site Admin
Posts: 196
Last visit: Thu Mar 28, 2024 8:34 am

Re: PowerShell Service Template

Post by Olga_B »

Please update the PowerShell Studio to the latest build 5.6.162, and let me know if it solve the problem
This topic is 4 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.