Solved

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

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Set OWA language and time zone in Exchange for individuals, all users or per database.
Synchronize a new Active Directory domain with an existing Office 365 tenant
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

13 Experts available now in Live!

Get 1:1 Help Now