When append data to a txt file over our Local Area Network using Out-File in Powershell 7, the data is transform in strange characters. If I use the same code in Powershell 5.1 the appended data comes normal.
I also tried Out-File -encoding Ascii with the same result
<u>BUT</u> if I append data to the Local Machine using Powershell 7, the appended data is as expected.
Strange characters over LAN
潃灭瑵牥†楄歳匠穩⡥执 唠敳木⥢䘠敲⡥执 †牆敥┠†††慄整☠吠浩ⴊⴭⴭⴭⴭⴠⴭⴭⴭⴭⴭⴠⴭⴭⴭⴭⴭⴭⴭⴠⴭⴭⴭⴭⴭⴭⴭⴭⴭⴭⴭ婆ㅁ†††䌠›†ㄠ㘳㜮‰†㈠⸹㔸†ㄠ㘰㠮‵†㠷ㄮ┶ㄠ⼰㈲㈯㈰‰㌱㔺ഴ䘊䅚‱†††㩄††㔵⸸㌷†㈠㤸〮‹†㘲⸹㐶†㐠⸸㘲‥〱㈯⼲〲〲ㄠ㨳㐵婆ㅁ†††䘠›†㤠ㄳ㔮‱††⸰㐷†㤠〳㜮‷†㤹㤮┲ㄠ
I have tested this by writing to a file share on a NAS and to a file share on another Windows machine and I cannot replicate the problem.
Do you get the same problem if you try writing to a different server?
If you use Wireshark you should see the SMB2 traffic, you can use Follow TCP Stream to see what data is being sent. This will allow you to check if the correct data is leaving the device.
I tested from the console host but it also works fine for me from VSCode.
A Wireshark trace from the source computer should confirm the correct data leaves the computer.
Have you tried doing it host-to-host on the Hyper-V machines to try and narrow it down to the Hyper-V infrastructure? Presumably these servers are used for other things so I find it a bit odd that you don’t see corruption in other files or even the filenames themselves which I would expect if there was some problem with drivers or network adapters.