Write a service in powershell

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
Posts: 5
Joined: Fri Nov 14, 2014 7:02 am

Write a service in powershell

Post by 4100260298 » Wed Feb 03, 2016 7:28 am

I need to do some testing with a service. I'm wondering if it is possible to write a service with the appropriate handlers in powershell?

User avatar
Posts: 13803
Joined: Tue May 22, 2007 9:57 am

Re: Write a service in powershell

Post by jvierra » Wed Feb 03, 2016 7:36 am

No. PowerShell is not appropriate for creating a service. It cannot respond to service control. You can use the SDK to create a service that can host PowerShell scripts. Look into the Window Platform SDK PowerShell samples.