I'm having a problem at the moment deploying and managing windows services and I'm looking for advice on the best course of action.
Here's what I have working (below) - the problem is it's a bit flaky and doesn't always work from my build server and also doesn't give good reasons as why it fails. I generate these commands using nodejs and child_process.
- Attempt stop of remote service => (psexec)
- Attempt uninstall of remote service => (psexec)
- Deploy new code of service => (msdeploy)
- Attempt install of remote service => (psexec)
- Attempt start of remote service => (psexec)
I'm thinking I should maybe change from using psexec and switch to powershell but I don't have the experience to say one way or the other.
I need solid error codes from running psexec but at the moment I'm not sure how to do it. I could go for a rewrite and ditch psexec in favour of powershell but I don't know if that's the right call or now.
I could try something like psexec \\destination -c stopanduninstall.bat
but I'm not sure it that would work better or not and I'm weary of investing too much more time
The other thing I found was https://stackoverflow.com/questions/13844231/batch-file-catching-psexec-result which might work better for catching the errors in the first place and making it more reliable