Hello,
How do you turn a PowerShell script into a service? I used NSSM
for this, but after a minute the service paused!
Thank you.
Hello,
How do you turn a PowerShell script into a service? I used NSSM
for this, but after a minute the service paused!
Thank you.
Does this help?
Hi,
Thank you so much for your reply.
1- Which method do you use?
2- Which of the NSSM
, sc.exe
or PSService
module methods is appropriate?
3- Is the PS2EXE
module suitable for converting a PowerShell script to an .exe
file?
None. I don’t have any use case for a service written in PowerShell.
Anyone that works for you, I’d say.
I haven’t come accross any business use case where I needed to convert a PowerShell script to an executable.
Just out of curiousity: What is your business use case? What are the benefits you’re looking for?
Hello,
Thanks again.
I want to convert the script to an executable file because I feel it will run faster.
If this is going to be running on a server it would have higher priority as a service, if it’s a workstation it will have a lower priority as a service.
If you really want it to run faster I would build it to use runspaces. This is assuming the runspaces are appropriate for the use case. Without seeing code I can’t say for certain.
For the most part, this is not going to happen. The key factor for performance is code efficiency.
I wouldn’t want to base my business decisions on feelings.
In doubt - measure it!
Regardless of that … doesn’t it run fast enough? Does it really need to run faster? If you have already used up all optimization options PowerShell offers without the need to compile it, PowerShell may not be the right tool for the job.
Hello,
I used the WinSW
tool and the problem was fixed.
Thank you.