'Windows PowerShell is in NonInteractive mode. Read and Prompt

     win_shell: | 
     Get-disk
     Initialize-Disk -Number 2 -PartitionStyle MBR
     clear-disk -number 2 -removedata -Confirm:$false
     Initialize-Disk -Number 2 -PartitionStyle MBR
     new-partition -disknumber 2 -usemaximumsize | format-volume -filesystem NTFS - 
     newfilesystemlabel Data -Force
     get-partition -disknumber 2 | set-partition -newdriveletter G

In the above code getting "Windows PowerShell is in NonInteractive mode. Read and Prompt." I am executing the above code using ansible playbook. Manually it is getting executed but when executed through the ansible getting error. Please help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source