Scripting Blog [archived]

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

Latest posts

PowerShell for Programmers: A Quick Start Guide
Jan 4, 2018
Post comments count 0
Post likes count 2

PowerShell for Programmers: A Quick Start Guide

Kory Thacher
Kory Thacher

Now that my content has been migrated to the scripting blog, this will be the landing page for the series and I'll be trying to update all the links.  Learning PowerShell can be very useful for people with programming experience. Whether you’re currently a developer, dev-ops, or an admin you can get some serious use out of being familiar with PowerShell. You might think its just a version of command prompt with an eye-burning color scheme, but it really is a full scripting language with lots of nice tie ins. PowerShell is geared towards IT admins and made easy to learn with lots of nice shortcuts, and auto-...

PowerShell For Programmers: Basic Syntax — CMDLETs
Jan 4, 2018
Post comments count 0
Post likes count 4

PowerShell For Programmers: Basic Syntax — CMDLETs

Kory Thacher
Kory Thacher

PowerShell might look really strange to you. Many people assume PowerShell is basically CMD-prompt 2.0 because of the way it looks, but it really is a fully operational scripting language underneath. PowerShell has something called a cmdlet (command-let), which for the most part is the same idea as functions you're used to from other languages. I'll assume you're coming from a more classic language and you're used to calling functions like this: If you've been using cmdlets in PowerShell like this, you've been doing it wrong. This could cause you some serious problems down the line. "But I can type ...

Cross-platform PowerShell remoting in action
Dec 29, 2017
Post comments count 0
Post likes count 0

Cross-platform PowerShell remoting in action

Doctor Scripto
Doctor Scripto

Summary: Learn how to configure and use cross-platform PowerShell remoting in PowerShell Core. I’m Christoph Bergmeister, a London-based full stack .NET software developer with a passion for DevOps. To enable product testing of .NET Core apps across non-Windows machines in CI, I was one of the first people to use the new cross-platform remoting capabilities based on an integration of OpenSSH with PowerShell Core. In the early days, setup was very tedious, and as part of my journey I had to experiment a lot to get everything working together nicely. Today, I want to share with you some of what I learned. Introduc...

Script Wars: The Farce Awakens (part V)
Dec 22, 2017
Post comments count 0
Post likes count 0

Script Wars: The Farce Awakens (part V)

Doctor Scripto
Doctor Scripto

Summary: Rey is skilled in PowerShell, and new to Contoso Holly Jolly Hat Company. Already she has been a great boon to her new co-workers and had her sneakers become the subject of a hungry trash robot. She was just about to walk out to the hall with Ben Kerberosie, when suddenly an dominant figure has blocked them, with the following words booming through the hall: "WHO DO I SPEAK TO ABOUT CLEAR TEXT PASSWORDS in POWERSHELL!?!" ---------------------- That entity was none other than Katherine Phantampa! Head of IT Security, and also known as The Gatekeeper. The Protector of Data. The Guardian of all that was...

Script Wars: The Farce Awakens (part IV)
Dec 21, 2017
Post comments count 0
Post likes count 0

Script Wars: The Farce Awakens (part IV)

Doctor Scripto
Doctor Scripto

Summary: A quick recap shall we? Newly graduated from IT training and future guru in the world of Windows PowerShell, Rey Skyworker has been hired on by her mentor, Ben Kerberosie. Already, she has helped peers from her team improve their PowerShell code to do some basic error trapping and cleanup of the data upon entry. Not bad for somebody on their first day, eh? Oh, almost forgot, her shoelaces have been chosen as lunch by a new Beta cleaning robot with more suction than common sense. Shall we continue? Let's! -------------------------- Tin has been left back to tend to the help desk, while Ben continues ...

Script Wars: The Farce Awakens (part III)
Dec 20, 2017
Post comments count 0
Post likes count 0

Script Wars: The Farce Awakens (part III)

Doctor Scripto
Doctor Scripto

Summary: When last we saw our hero, Rey Skyworker, she was aiding her new co-worker, Tin. They managed to implement better error trapping by using the "Try Catch" statement in Windows PowerShell. The fact they could do this so easily it has tickled Tin's curiosity. ---------------------------- "Now Rey, I'm looking at this and as I see it, I could avoid the error altogether by trapping for those situations. Maybe adding in a few IF statements like this to the script." If (($First -or $Last)) -eq '') then { Write-Output 'Names cannot be blank } Else { ….rest of the script } Rey nodded. "You mean adding ...

Script Wars: The Farce Awakens (part II)
Dec 19, 2017
Post comments count 0
Post likes count 0

Script Wars: The Farce Awakens (part II)

Doctor Scripto
Doctor Scripto

Summary: Yesterday, we met a newly graduated IT professional, Rey Skyworker, as she discussed the ways of "The Farce." It was during this discussion that her instructor, Ben Kerberosie, discovered she had a natural gift in understanding how to implement some good practices into writing her scripts. Today, we sit quietly (I mean all of you in the back too, no chattering and tossing about popcorn!), as Rey is about to embark on her new job. The position: on the help desk. The company: Contoso Holly Jolly Hat Company. She is being introduced to her new co-worker on the help desk, Jeremy Tinnison. ---------------...

Script Wars: The Farce Awakens (part I)
Dec 18, 2017
Post comments count 0
Post likes count 0

Script Wars: The Farce Awakens (part I)

Doctor Scripto
Doctor Scripto

Summary: Seven years ago, “Hey, Scripting Guy!” was approached by a member of the community to see if we would be interested in doing something a little fun for the holidays.  The result was a seven-part series called “A PowerShell Carol.” So when we were approached continuously in following years, we allowed this madness to continue! The tradition continued on with the "Blues" in Blueville and Curly Blue, amongst others, doing a twist on popular holiday stories. The community even dared to touch upon classic tales, with "Oliver Script," a "twist" on another famous story by Mr. Dickens. And now, we bring you th...

PowerShell support for certificate credentials
Dec 15, 2017
Post comments count 1
Post likes count 0

PowerShell support for certificate credentials

Doctor Scripto
Doctor Scripto

Summary: It's not a very well-known feature, but the PSCredential object, and the PowerShell Get-Credential cmdlet, both support certificate credentials (including PIN-protected certificates). In this post, we take a look at how a certificate credential is marshaled inside a PSCredential object, how you can do this marshaling yourself, and how you can retrieve the original certificate from a PSCredential object supplied to you. Most Win32 APIs that support the PSCredential object for credential validation already support certificates. However, if your code currently consumes a PSCredential, and you use the user ...