Executing remote PowerShell script not generating required output

Hello All,

I am trying to execute a PowerShell script present on remote system. It is executing successfully from ansible playbook side.

After execution it should generate a password.csv file on the remote system, but that file is not getting generated.

My plabook:

  • name: test
    hosts: test
    tasks:
  • name: warning
    win_shell: powershell.exe -ExecutionPolicy ByPass -File C:\GeneratePassword.ps1

Please help me on this if anyone having any idea.

Thanks in advance

Regards
Harsh

Hello Harsh,

Please try this one

  • name: test
    hosts: test
    tasks:
  • name: warning
    script: C:\GeneratePassword.ps1