Windows Service Validation Check to Inhibit Service Start
Posted: Sun May 24, 2020 7:34 am
Hello,
I've been playing a bit with this and overall get how it works and have created/installed a basic service without issue:
https://www.sapien.com/blog/2017/07/12/ ... owershell/
I'm sure I'm just missing something but I'm trying to prevent the service from starting should something like a file/directory/reg key not be present. As as an example, one thing I've tried is this:
if (-Not (Test-Path "C:\ValidationFolder")) {Exit}
But I've also tried triggering the function Stop-MyService, creating my own functions, inserting code like the above within, etc.
I'm running PrimalScript 2019 v7.4.125.0
Thx!
I've been playing a bit with this and overall get how it works and have created/installed a basic service without issue:
https://www.sapien.com/blog/2017/07/12/ ... owershell/
I'm sure I'm just missing something but I'm trying to prevent the service from starting should something like a file/directory/reg key not be present. As as an example, one thing I've tried is this:
if (-Not (Test-Path "C:\ValidationFolder")) {Exit}
But I've also tried triggering the function Stop-MyService, creating my own functions, inserting code like the above within, etc.
I'm running PrimalScript 2019 v7.4.125.0
Thx!