I wrote this in response to a newsgroup (microsoft.public.windows.powershell) question about creating services. Ok, technically, he didn’t ask, but I couldn’t let the “you can create a service in Firedaemon!” go unaddressed.
Firedaemon? Come on, that is so Y2K!
This script isn’t polished. Ideally you’ll want the ability to specify some or all of the parameters as arguments, perhaps do some error handling if the create fails, and so on. I’ll leave that as an exercise for the reader. Also, be sure to read the MSDN docs for the Create Method of the Win32_Service Class to learn the field definitions.
File attachment: CreateService.ps1

Your PowerShell script will only work to create a service from an existing executable that knows what to do when it’s running. Most executables don’t handle this an so they won’t ever change from ‘starting…’ to ‘started’.
Firedaemon is just a tiny bit of glue that launches the real executable and then tells the service controller that all is good.
True. In the context of the newsgroup thread this makes more sense. My reply was “you could use srvany, or you can insert them using powershell”. I wanted this blog post to be more generic in nature.