Solved

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

Posted on 2011-09-10
2
449 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 Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
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…

752 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