The “Hey, Scripting Guys!” blog has been retired. There are many useful posts in this blog, so we keep the blog here for historical reference. However, some information might be very outdated and many of the links might not work anymore.
New PowerShell content is being posted to the PowerShell Community blog where members of the community can create posts by submitting content in the GitHub repository.
Scripting Blog [archived]
Formerly known as the "Hey, Scripting Guy!" blog
Latest posts

PowerTip: Use PowerShell to play WAV files

Make use of the native features of Windows through PowerShell to play sound.

Windows PowerShell and the Text-to-Speech REST API (Part 4)

Send and receive content to the Text-to-Speech API with PowerShell.

PowerShell PowerTip: Grabbing the location your script lives in
One super common thing in PowerShell is to design a script to consume particular files for data. Often times you are building the script right in the folder for your files. However, it can be annoying to give long, literal file paths to a file. Also, if you give that script to someone else, they need to edit that path to point at the right location-- how annoying! There is a built in variable to help with this scenario: $PSScriptRoot will provide the file path the script was run from, which can let you relatively point at files. You can see an example of this in an older blog post. I received a few questions ab...

Working with JSON data in PowerShell
Welcome back everyone! This week we will take another look at some common data types we might encounter in the real world: JSON data. JSON data is used pretty frequently on the web if you're hitting APIs. This not only includes external data (twitter, weather, marvel database), but often includes internal data to your company. It's nice to be able to leverage data from anywhere, and it can be frustrating for people to try to parse JSON data. Luckily, we have this all built in for you using ConvertFrom-JSON I'll get a response from an API online used for testing: The response data looks like this: A...

PowerTip: Ensure that errors in PowerShell are caught

Here’s how to make sure your errors get caught with Try Catch Finally.

Windows PowerShell and the Text-to-Speech REST API (Part 3)

Use Windows PowerShell to access the Cognitive Services Text-to-Speech API.

PowerShell PowerTip: ISE crashing and auto complete not working
Hi all, I'm going to start putting out these short PowerShell PowerTips every so often. They won't be full blog posts, but they will be short and useful! Have you been having issues with the ISE crashing and not auto completing since windows update 1803? From what I've seen there is a fix for this coming, but if you need these features now you can try the 2016 ISE preview To try it run as an admin and do this: Then go ahead and pin it while you wait for the fix. You can also check out VS Code Happy PowerShelling!

Run PowerShell code in Puppet

Normally, it’s preferable to use specific Puppet and DSC Windows modules to manage systems in Puppet, but an alternative is running PowerShell commands and scripts by using the exec resource. This can be helpful for transitioning existing PowerShell code into Puppet quickly.

Doing more with functions: Verbose logging, Risk mitigation, and Parameter Sets
Welcome back to PowerShell for Programmers, this week I'm trying gitGist again for the code blocks. Let me know what you think about it vs the normal syntax highlighter I use :) As we've seen in the other posts about functions, attributes are a really cool thing to extend the features we have available to ourselves and for our users. This post is going to deal with an attribute for the function itself as well as ones for the individual parameters. This will let us make our functions behave more like any other cmdlet, by giving us access to the common parameters that users are used to seeing. Common Parameters...