Powershell code in Ansible playbook returns non zero error code

Hi All, i have an issue respect to powershell code which i am using to delete file from windows machine using an Ansible code via AWX i have mongodb lookup value= ‘C:/Users/abcd/abcd/’,‘C:/abc/’, code is delete the file in the folder but returning error i have attached the code and error i am getting please help me on this, i have get this done over the weekend

Hi Nasir

Sorry to hear this, it does sound like bad planning on your side.
Please don't make that our problem, this is a best effort support list
with no SLAs etc.
On that note - you will significantly increase the chances of someone
helping you if you post text instead of mostly unreadable screen
dumps.

Dick

Have you Tested the Powershell Code on a local machine to make sure it’s working ?
You could:

  • Create the Powershell Script in Name.ps1
  • Copy Name.ps1 to Temp
  • Run it and then Remove name.ps1 from Temp Folder

In the past, I had issues with running Powershell Scripts using Ansible, Now if i need to use Powershell, Adding / Removing AD Objects I just use SaltStack for that.