Scripting Blog [archived]

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

Latest posts

PowerShell PowerTip: What is the point of Out-Variable?
Jul 24, 2018
Post comments count 0
Post likes count 2

PowerShell PowerTip: What is the point of Out-Variable?

Kory Thacher
Kory Thacher

A lot of times people see others using the common parameter -OutVariable instead of the best practice $var = <value>. This leads to a lot of folks wondering why OutVariable  exists. The real use for OutVariable is to save your data off, while still letting it get sent along the output stream. What this means is that you could use it somewhere inside of a pipe to save some data for later re-use, but continue doing other work with that data. Notice that even though the data continued being pipped along, I could also reference it later when I asked for the count. Hope that helps, tune in more ...

PowerTip: Turn off the power to your computer with PowerShell
Jul 16, 2018
Post comments count 1
Post likes count 0

PowerTip: Turn off the power to your computer with PowerShell

Doctor Scripto
Doctor Scripto

I’ve got a script that needs to power off a system after it’s done. How can I accomplish this with PowerShell?

Parse HTML and pass to Cognitive Services Text-to-Speech
Jul 16, 2018
Post comments count 0
Post likes count 0

Parse HTML and pass to Cognitive Services Text-to-Speech

Doctor Scripto
Doctor Scripto

Having some fun with Abbott and Costello’s “Who’s on first?” comedy routine, and multiple voices with Bing Speech.

PowerShell PowerTip: What you should know about streams
Jul 10, 2018
Post comments count 0
Post likes count 0

PowerShell PowerTip: What you should know about streams

Kory Thacher
Kory Thacher

PowerShell has a concept called Streams, which are the different places data can go (output, error, verbose, etc). You usually don't have to worry too much about these streams if you're just writing simple scripts, but it helps a ton to know: What this means for you, as users, is that you can get a non-terminating error, and still do work on the successful output. Take a look at this: Notice that even though I received an error for the process "FAKE", only the non-errors were present in $procs. Using some basic error handling we could clean that up, hide the error message and log out wha...

Regular Expressions (REGEX): Introduction
Jul 5, 2018
Post comments count 0
Post likes count 0

Regular Expressions (REGEX): Introduction

Kory Thacher
Kory Thacher

Hi all, this week I'll be talking about Regular Expressions. I've got a few posts planned to get you set up and going with some basic Regex. Regex is used for extracting and validating data. Essentially, you can think of Regex as windows wild cards on steroids. Anytime we need to match data with a little more clarity than the *s and ?s that windows gives us, we have Regex. Regex has a reputation for being difficult and confusing, but it really isn't so bad when you get used to it. The biggest contributors to Regex's reputation are: With that in mind, let's take a look at a sample about why you ...

PowerTip: Determine your version of PowerShell and host operating system
Jun 29, 2018
Post comments count 1
Post likes count 0

PowerTip: Determine your version of PowerShell and host operating system

Doctor Scripto
Doctor Scripto

Identify your PowerShell environment by making use of built-in PowerShell variables.

Windows PowerShell and the Text-to-Speech REST API (Part 5)
Jun 29, 2018
Post comments count 0
Post likes count 0

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

Doctor Scripto
Doctor Scripto

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

PowerShell PowerTip: Checking your PowerShell version
Jun 26, 2018
Post comments count 0
Post likes count 0

PowerShell PowerTip: Checking your PowerShell version

Kory Thacher
Kory Thacher

If there is one question I could say I get the most in PowerShell, it is: How do I check my version? Its not a hard thing, but its not an obvious thing. We can actually check our version with a build in variable called PSVersionTable Hope that helps, tune in more often to get short and sweet PowerTips!

PowerShell For Programmers: Here Strings, There Strings, Everywhere Some String Strings
Jun 19, 2018
Post comments count 0
Post likes count 0

PowerShell For Programmers: Here Strings, There Strings, Everywhere Some String Strings

Kory Thacher
Kory Thacher

There won't be much code in today's post, but this can be a useful feature to know about. In addition to the expandable and literal strings we talked about, we can also use something called a Here String. Here strings allow us to have quote characters inside of our string that match the quote characters we use to create that string. For example, you might want the double quote character to appear inside of your expandable-string. You could use the escape character on the internal quote to prevent it from closing your string, but if you had a massive amount of quotes this would be annoying. Here strings exis...