Solved

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

Posted on 2011-09-10
2
445 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
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Hi all.   The other day I had to change the passwords for a bunch of users on the fly. Because they were so many, I decided to do it in an automated way and I would like to share it with you all.   If you are not doing it directly in a Domain Co…
Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now