Ansible get Powershell return slowly

We found ansible running powershell script on windows ,get return slowly or failed.
Actually the script already finished ,but Ansible can not get return back.

Open SSH version :

Here is my test time record:
Start Ansible Task Time:14:32:06
Script Create Time on Windows:14:32:16
Script Run start time:14:32:24
Script Run End time:14:32:35 (which time the txt show “End”)
After the script run finished , ansible still show running status. it have been running already 1 hours.

  • my code
    $j = 10
    $date = get-date -format yyyyMMddHHmmssfff
    $filename = “C:\Users\ScriptTest_$date.txt”
    echo $date >>$filename
    for($i=0;$i -le $j;$i++){
    $now = get-date
    $now >>$filename
    sleep 1
    “End” >>$filename