On Thursday, March 17, 2016 at 4:54:59 PM UTC+5:30, ishan jain wrote:
>
> Both get-service and sc.exe returns textual results. I will have to match
> strings to check if service exists and its state and i never like to base
> my conditions on pattern matching.
> The best solution i could thing
Agreed with your point - we should drag the machine in the state we want.
But in my case the number 1 priority is to make the script idempotent,
which seems like quite a thing on windows end.
I not installing anything on the windows end and my application will run as
standalone service, no inst
You could run a raw powershell command like
Get-Service nameOfService -ErrorAction SilentlyContinue
and then register the result, then check
You would need the '-ErrorAction SilentlyContinue' bit otherwise when the
service doesn't exist, Get-Service will fail.
also if you prefer you could do
I suggest you add a task, before your win_service task that installs the
service if it is not yet installed. Depending on what the service is, you
might be able to use win_package to install it. If it is already
installed, there is not much to loose by running the win_package task a
second ti
Both get-service and sc.exe returns textual results. I will have to match
strings to check if service exists and its state and i never like to base
my conditions on pattern matching.
The best solution i could thing of is to go with win_service and define a
failed_when situation along with. At l