Scripting Blog

A place to learn about PowerShell and share stories of automation

Hey, Scripting Guy! How Can I Use Windows PowerShell to Determine Whether a Local User Account Exists?

Hey, Scripting Guy! How can I use Windows PowerShell to determine if a specified local user account exists on a computer?-- MM Hey, MM. Have you ever heard the expression “good things come to those who wait”? Well, to tell you the truth, the Scripting Guys have never put much credence in that old saying; after all, the Scripting Guy who...

Hey, Scripting Guy! How Can I Remove Delimiters, and Fix Apostrophes, in a CSV File?

Hey, Scripting Guy! I have a comma-separated values file (CSV) that uses double quote marks as the field delimiter; unfortunately, this file also uses a double quote mark any time it should use an apostrophe (like in the name O’Malleys). Somehow I need to remove all the delimiters and convert the appropriate double quote marks to an ...

Hey, Scripting Guy! How Can I Compare Two Strings Values and Then Report Back the Result of That Comparison?

Hey, Scripting Guy! I need to write a command-line script that, given two arguments, can compare the two values and then – using standard errorlevel – report back whether string 1 is greater than or less than string 2, or if the two strings are identical. Can you help me with that?-- JP Hey, JP. You know, in the past few days the sports...

Hey, Scripting Guy! How Can I Sort Digital Files By the Date Each Picture Was Taken?

Hey, Scripting Guy! I read your article on renaming image files so that the pictures could then be sorted in chronological order. When I ran your script, however, it didn’t quite work for me: the files were renamed, but the pictures weren’t sorted the way I had hoped they would be. I think that’s because the pictures were being renamed...

Hey, Scripting Guy! How Can I Search a Folder For All the Image Files That Are Not a Specified Height and Width?

Hey, Scripting Guy! I have a folder on a server that contains employee photos, photos that will be used on our organization chart. New photos are taken daily for new staff members, and all the .JPG files are put into this folder. Because the photos are often different sizes, I would like to write a script that checks the folder for photos ...