Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Use PowerShell to Remove Duplicate Lines from a CSV File

Summary: Learn how to use Windows PowerShell to easily remove duplicates from a CSV file.   (image) Hey, Scripting Guy! I have a comma-separated value (CSV) file that comes from a Microsoft Excel spreadsheet. We use this CSV file to create new users automatically in Active Directory. The problem is that every once in a while, duplicates ...

Use PowerShell to Append CSV Files Easily

Summary: Learn how to use Windows PowerShell to easily append one CSV file to another CSV file.   (image) Hey, Scripting Guy! I have a problem, and I have searched everywhere on the Internet to find an answer. I need to be able to append one comma separated value (CSV) to another CSV file and create a new CSV file. I know that I can use ...

Convert a Semicolon-Delimited File to a CSV File

Summary: Learn how to convert easily a semicolon delimited file into a CSV file using Windows PowerShell.   (image) Hey, Scripting Guy! I have a problem at work, and I hope you can help. We have an application that writes one log file every four hours. These log files are formatted with semicolons, which makes them a pain to work with. My...

Easily Remove Columns from a CSV File by Using PowerShell

Summary: Use a super simple, one-line command to remove columns easily from a CSV file using Windows PowerShell.   (image) Hey, Scripting Guy! I have a CSV file from which I need only two of eight columns. Can Windows PowerShell delete certain columns? I have searched the Internet for days with no luck. —RK   (image) Hello RK, ...

Use PowerShell to Work with CSV Formatted Text

Summary: See how to use Windows PowerShell to create CSV files from formatted and unformatted text.   (image) Hey, Scripting Guy! I have begun to play around with Windows PowerShell, and it is absolutely the most confusing thing Microsoft has ever created. Simple things are easy. I can use Get-Process and Get-Service with no problem, but ...