PowerShell for Windows Admins

Jun 26 2019   10:38AM GMT

Quotes in CSVs

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Tags:
Powershell

Up to and including PowerShell v6.2.x converting or exporting data to a csv has automatically put quotes round each field. In PowerShell v7 you can control quotes in CSVs

Using

Get-Service | ConvertTo-Csv

as an example.

The current behaviour is to put quotes round everything

“XboxNetApiSvc”,”System.ServiceProcess.ServiceController[]”,”False”,”False”,”False”,”Xbox Live Networking Service”,”Syst
em.ServiceProcess.ServiceController[]”,”.”,”XboxNetApiSvc”,”System.ServiceProcess.ServiceController[]”,,”Stopped”,”Win32
ShareProcess”,”Manual”,,

This is still the default behaviour in PowerShell v7 but there’s now a –usequotes parameter to control the quotes. Its default value is always to match previous behaviour.

Other options are AsNeeded and Never

AsNeeded consistently threw an error but Never seems to work

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: