Can you write Windows services in Powershell

前端 未结 5 1307
执念已碎
执念已碎 2020-12-18 14:38

I have written a program in PowerShell that loops and checks stuff. I would like to convert this into a Windows service. I\'ve created a Windows service (in Admin->Services)

5条回答
  •  天命终不由人
    2020-12-18 14:53

    If you absolutly want to execute your PowerShell code into a service, I think you can write a C# service wrapper for PowerShell code.

    You found examples of how to create a service with C#, and it's simple to call Powershell from C#. So I'am surprised that as small SrvAny oriented PowerShell does not exists yet.

    My advice here, you better rewrite your code in C# as a service.

提交回复
热议问题