Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, August 29, 2012 2:57 PM
Hi,
I am new to Powershell.I have problem in reading the output in Japanese ,below is the script I am using
$query = "Select * From Msvm_ComputerSystem "
$VOs = (gwmi -query $query -namespace "root\virtualization" -Cred $cred -Computername $computer )
This script runs in a server ,connects to remote hyper-v server to get information.
formatted output displays as shown below -
Name=WIN-B3529U0800R
ElementName=WIN-B3529U0800R
Description=Microsoft ???????
EnabledState=2
Caption=???????
IP=
ProcessId=
HostName=WIN-B3529U0800R
Name=AAA180ED-94A5-47D7-8F91-CEC30B351D5B
ElementName=?????
Description=Microsoft ???
EnabledState=2
Caption=???
IP=
HostName=WIN-B3529U0800R
All the question marks are Japanese characters which displays fine in Japanese powershell.Requirement is to get the ouput correctly(Japanes/Chinese) in English Hyper-v and pass it to java code for further processing.Please suggest how can I fix this.
Thanks,
Chetan
All replies (5)
Wednesday, August 29, 2012 8:36 PM ✅Answered
I thinks easy way using PowerShell ISE instead of powershell console.
Pass correct encoding,you may use:
$OutputEncoding - http://blogs.msdn.com/b/powershell/archive/2006/12/11/outputencoding-to-the-rescue.aspx
Wednesday, August 29, 2012 3:00 PM
Correction:
All the question marks are Japanese characters which displays fine in Japanese powershell.Requirement is to get the ouput correctly(Japanes/Chinese) in English POWERSHELL and pass it to java code for further processing.Please suggest how can I fix this.
Thursday, August 30, 2012 8:40 AM | 2 votes
If you want display national symbols in Powershell window you may open properties of the windows, select Font tab and select TrueType font.
Сазонов Илья http://isazonov.wordpress.com/
Friday, August 31, 2012 3:45 PM
Thanks Kazun, It does work on powershell ISE,but not sure if I can just replace PS console with ISE...seems there is some complication in invoking powershell_ise from c# http://www.vistax64.com/powershell/265426-how-invoke-powershell-ise-c-code-specific-script.html
Friday, August 31, 2012 3:48 PM
Thanks ILYA