Forum Discussion
Output in CLI different that what is saved in log file ?!
I tried this and it works fine but the output saved in the file did not change and remains the same which bring in Encoding.
I came to know 2 things.
1) There is a $PSDefaultParameterValues = @{ '*:Encoding' = 'UTF8' }. The questio is if this sets Encoding of the whole script from the start (added to the start of the script), or does it change the Encoding of which ever fils is created durin gscript runtime ?
2) Add-Content has an -Encoding switch but I'm not sure how this would work with Tee-Object since Add-Content adds to the file, and Tee-Object adds to the file and displays in the CLI as well ?!
Hi, Touqueer.
You can remove the value from PSDefaultParameters as shown below - which you would need to do since Tee-Object offers no control over encoding.
Reference
Examples
Once you've removed the relevant encoding entry from $PSDefaultParameterValues, try your command again - the file output should now be fine.
Cheers,
Lain