I am using a script that runs on few computers, running Net command query on every one and comparing the results of any one with Compare-Object.
The script is:
Net users /domain
Some of the users in my environment has Spanish letters. When running the command locally, the output returns the user with the correct letters is spanish, But when running it remotely from another computer with Invoke-Command, the output of these specific users shows with symbols.
Example for user running locally:
Net users /domain
Adam Ñ
Example for user running running remotely with Invoke-Command:
Invoke-Command -Computername MyWin7Comp -scriptblock {
Net users /domain}
Adam ¥
I found a fix in Windows 10 1803 ONLY that has the option of using always UTF-8 Unicode. Windows 10 1803 option only
And it worked! running the script remotely ON this windows 10 1803 machine works perfectly, but I also want to run in on older versions...
What can I do?
Thank you