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

Reporting on Digitally Signed Files with PowerShell

Summary: Using the Get-AuthenticodeSignature cmdlet to show if a file is Digitally Signed Q: Hey, Doctor Scripto! I was curious, since many new files are Digitally signed with a certificate if there was an easy way to see the status of the Digital Signatures of many files easily? —SH A: Hello SH your good friend Doctor Scripto is here today to help you along. One of the things which changed with PowerShell in version 3.0 was a beautiful little Cmdlet called Get-AuthenticodeSignature This Cmdlets task was very simple, examine a file and show the properties of the Digital Certificate on a file. He...

Clean up Domain Controller DNS Records with Powershell

Summary: Using Windows PowerShell to remove Stale / Dead Domain Controller records. Q: Hey, Doctor Scripto! How can I quickly clean up all my dead Domain Controller’s DNS records? A: That’s a great question. The good Doctor also knows the very person to answer it best. My good friend Patrick Mercier, An Active Directory PFE who loves working with PowerShell. Take it away Patrick! Whether it’s as part of Active Directory Disaster Recovery, or because you had an old Domain Controller you needed to get rid of, cleaning up all the DNS records of a now dead DC left behind can be tedious: that is, unl...

PowerShell PowerTip: Customizing your prompt
I've been taking a break from the blog for a while due to some personal reasons, but I had a few people ask me about my PowerShell prompt recently. I like extra horizontal space, so I removed the path from the prompt and put it in the window title bar. I also just display the current time in the prompt itself. You can customize your prompt by using your profile and overriding the "Prompt" function. A coworker of mine, Tony Radkiewicz, used a similar prompt and I really liked it so I've been using it since. That's all for now, I'll try to get some...

PowerTip: Use PowerShell to pick a random name from a list

Using the Get-Random Cmdlet to select a random list of names instead of numbers

Using PowerShell to create a folder of Demo data

Creating sample files with random sizes and dates for use in a Lab

PowerShell PowerTip: searching and installing modules on the command line
PowerShell 5+ ships with the module PowerShellGet, which lets us search and install modules from cmdlets. The default nuget repository is the PowerShell Gallery, but you could add others yourself (including custom ones for internal modules). There are a lot of reasons this could help you: There are a lot of cmdlets in the module, but the ones you'll use the most will be: You can also specify the scope on install-module and put it in your user module location for ones just for you on a machine. Hope that helps, tune in more often to get short and sweet PowerTips!
![Regular Expressions (REGEX): Grouping & [RegEx]](https://devblogs.microsoft.com/scripting/wp-content/uploads/sites/29/2020/10/dr_scripto.jpg)
Regular Expressions (REGEX): Grouping & [RegEx]
Welcome back to the RegEx crash course. Last time we talked about the basic symbols we plan to use as our foundation. This week, we will be learning a new way to leverage our patterns for data extraction and how to rip our extracted data into pieces we care about. [RegEx] The  data type has some cool static members, but we're mostly going to play with the plural method if you don't know what static members are you can check this post or this help data. A lot of the time, when we work with RegEx we are using it to extract everything that matches our pattern in a large amount of data. Using  like we did in t...

PowerShell PowerTip: History of commands with PSReadline
One of the really cool things PSReadline provides (module shipping on v5+) isn't as immediately obvious as the syntax highlighting. It offers a persistent history that is stored from session to session. This means if you run commands in a window, close it, and open a new one later you can still hit the up arrow and scroll through them. I use this feature quite a bit doing demos or just working on things where I want to clear out my whole scope and jump back in. If you want to opt out you can as well: Hope that helps, tune in more often to get short and sweet PowerTips!

Regular Expressions (REGEX): Basic symbols
Welcome back to the RegEx guide. Last post we talked a little bit about the basics of RegEx and its uses. I mentioned the most important thing is to understand the symbols. Today we'll ease in with some of the basics to get us going, but later we will expand on these and see some other options we have.  is used to represent any single character, aside from a newline, so it will feel very similar to the windows wildcard  is the escape character for RegEx, the escape character has two jobs: We can use  to specify quantity in a few different ways by attaching them to characters or symbols. ...