Thursday, February 26, 2009

Powershell Encoding - Grep

I was writing something where powershell ran on the remote host and copied files to a second box. On the second box I would run a perl script and take any any lines containing "Time:" "Finished zone:", had trouble.

Found out that
cmd - "dnscmd /zoneprint zonename.com > zone-zonename.com.txt "
powershell - "dnscmd /zoneprint zonename.com > zone-zonename.com.txt "

give files with different encoding.

I ended up using | Out-file -Encoding utf8 zone-zonename.com.txt

No comments: