The other day I shared my PowerShell plans for 2022. And needless to say, I didn’t wait to dig in. I am working on a new module and since it won’t be published until next month, I went ahead and marked it as Core only. I also started writing a set of Pester 5.x tests…
PowerShell Plans for 2022
I’m not much for writing year in review pieces. Nor, to be honest, do I often write New Year’s resolutions. But I’ve been thinking about the work I’ve done this past year and what I might be doing in 2022 so I thought I’d share some thoughts on what 2022 will look like for me,…
Building a PowerShell Module Inception-Style
Over the course of the last week or so, I’ve been sharing PowerShell functions and scripts for working with PowerShell functions and scripts. I showed PowerShell functions to export functions to a script file and code to convert scripts to functions It has all been very Inception-like. To wrap this all up I thought I’d…
Fun with PowerShell Module Layout
As I’ve been working on my new PowerShell project, which I’ve discussed over recent posts, I keep “discovering” fun scripting opportunities. Today I want to share some code I’ve come up with that makes it easier to build a PowerShell module directory structure. There are plenty of existing tools and scripts for scaffolding a project…
Discovering Aliases with the PowerShell AST
I’ve been working on a new PowerShell module that incorporates code from a few of my recent posts on converting PowerShell scripts and functions to files. I even whipped up a script, think of it as a meta-script, to create the module using the commands that I am adding to the module. I’ll cover that…
Converting PowerShell Scripts to Functions
Recently, I shared some PowerShell code to export a function to a file. It was a popular post. My friend Richard Hicks (no relation) thought we was joking when he asked about converting files to functions. His thought was to take a bunch of PowerShell scripts, turn them into a group of functions which could…
Exporting PowerShell Functions to Files
When I write a PowerShell module, it typically includes more than one export function. Where you store your module functions is a great discussion topic and I don’t think there is necessarily one best practice for everyone. I think it might depend on the number and complexity of the functions. Are other people contributing code…
Creating a PowerShell Clock
I’ve published a new project to the PowerShell Gallery. This is something that I needed, and maybe you do as well. Even though I have the typical clock running in the Windows taskbar, I have an ultrawide monitor so it isn’t always easy to read. I had been running the xclock app from WSL which…
Friday Fun: PowerShell Console Editing
The other day I read an interesting article on Adam Bertram’s blog about editing files with a text editor in PowerShell. Naturally, the PowerShell wheels in my head began turning. While I was intrigued by some of the options in the article, I’ve in fact installed the Micro editor to play with, I realized I…
Generate PowerShell Dynamic Parameter Code
One of the topics we’ve discussed in the PowerShell Cmdlet Working Group is a request to make it easier to insert dynamic parameters. I am a bit torn on this. On one hand, I see the value in dynamic parameters. These are parameters that only exist if some condition is met, such as if the…
Removing Obsolete PowerShell Remoting Configurations
I’m pretty sure I’ve discussed this before, but Microsoft is scheduled to release PowerShell 7.2 soon, I thought it might be good to revisit this topic. Here’s the potential issue. If you’ve been installing PowerShell 7 releases for a while, and have been enabling PowerShell remoting, you most likely have a list of remoting session…
Friday Fun: A PowerShell Welcome
I realized it had been a while since I wrote a Friday Fun post. These posts are intended to demonstrate PowerShell in a fun and often non-practical way. The end result is generally irrelevant. The PowerShell scripting techniques and concepts I use are the real takeaways. The task is nothing more than a means to…
Finding Modified Files with PowerShell
Here’s another task that I seem to be constantly fiddling with using PowerShell. What files did I work on yesterday? Or what files were modified in the last 48 hours? Obviously, Get-ChildItem is going to be the primary command. It is simple enough to get files based on an extension from a given folder path,…
Update Registry OS ProductName with PowerShell
I expect many of you are like me and have done, or will do, an in-place upgrade from Windows 10 to Windows 11. It is easy enough to run a PowerShell expression like this to see the operating system name. I get a value like Windows 11 Pro. However, operating system information is also stored…
There’s a File in My PowerShell Bucket
If there’s one task I’ve never stopped doing, it is finding files. I am constantly creating new ways to organize files and display them in a meaningful format. Naturally, PowerShell is a great tool for this task. Get-ChildItem is obviously the proper starting point. The cmdlet works fine in getting only files from a folder…