[ansible-project] Re: Powershell script works locally on windows machine but fails when attempted to run via playbook.

2020-07-29 Thread Darshan Yamakanamardi
Thanks a ton. It works as expected now. I appreciate your support. Have a great day ahead. Stay safe. Regards, Darshan On Thursday, July 30, 2020 at 1:08:03 PM UTC+9:30, jbor...@gmail.com wrote: > > This part '"*'{{ SITE }}'*"' means it will template the raw PowerSHell > script as 'Get-WebSite

[ansible-project] Re: Powershell script works locally on windows machine but fails when attempted to run via playbook.

2020-07-29 Thread jbor...@gmail.com
This part '"*'{{ SITE }}'*"' means it will template the raw PowerSHell script as 'Get-WebSite -Name "*'cdu'*" (with the inner single quotes). My guess is you want this to be 'Get-Website -Name "*{{ SITE }}*"'. There's no need to quote a jinja2 block unless you are starting the YAML value with {.

[ansible-project] Re: Powershell script works locally on windows machine but fails when attempted to run via playbook.

2020-07-29 Thread Darshan Yamakanamardi
Thank you very much for your response and for explaining the issue in detail. I have tried this and it worked as expected. In the playbook which you provided below, I would like to define the "cdu" as a variable since I have to identify it dynamically. (Actually, this playbook will be called

[ansible-project] Re: Powershell script works locally on windows machine but fails when attempted to run via playbook.

2020-07-27 Thread jbor...@gmail.com
So breaking down your error message you get the following PowerShell error(s) FINDSTR: Bad command line Stop-Service : Cannot find any service with service name 'ColdFusion 9 - '. At C:\Users\Administrator\Documents\servicerestart.ps1:7 char:1 + Stop-Service -Name "ColdFusion 9 - $ServiceNam