Solved

I'm having trouble exporting a field to a CSV.

Posted on 2011-09-10
2
448 Views
Last Modified: 2012-08-13
Ihave a script that retrieves various properties from my computers and exports them to a csv.

One of the fields is, @{label="Operating System";expression={$_.osname}}

What I should be getting is "Windows Vista™ Enterprise"
But instead when I open the csv the field is "Windows Vista? Enterprise"

When I use Out-File and save the results as txt it works correctly.

How can I get the correct value when exporting the results to a CSV?
0
Comment
Question by:LindyS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
gazm81 earned 500 total points
ID: 36517860
This is to do with the default encoding of out-file vs csv.
out-file by default goes to unicode and export-csv goes to ascii.

to make export-csv treat ™like out-file

append an option to the export-csv of

-encoding unicode
$variable | export-csv "file.csv" -encoding unicode

Open in new window

0
 
LVL 3

Author Closing Comment

by:LindyS
ID: 36517921
I'm not at work to test this, but it looks like it will do what I need.

Thanks or the information!
0

Featured Post

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question