As I resolved at the end of last year, I am doing more with Pester in 2022. I’m getting a bit more comfortable with Pester 5 and as my tests grow in complexity I am embracing the use of tags. You can add tags to different Pester test elements. Then when you invoke a Pester…
Tag: AST
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…
An Expanded PowerShell Scripting Inventory Tool
The other day I shared my code that I worked up to solve an Iron Scripter PowerShell challenge. One of the shortcomings was that I didn’t address a challenge to include a property that would indicate what file was using a given command. I also felt I could do better with performance in Windows PowerShell…
Building a PowerShell Inventory
A few weeks ago, a new Iron Scripter PowerShell scripting challenge was issued. For this challenge we were asked to write some PowerShell code that we could use to inventory our PowerShell script library. Here’s how I approached the problem, which by no means is the only way. Lines of Code The first part of…
Updated PowerShell Script Profiler
Last year I wrote a sidebar for the Scripting Guy, Ed Wilson and an update to his PowerShell Best Practices book. I wrote a script using the new parser in PowerShell 3.0 to that would analyze a script and prepare a report showing what commands it would run, necessary parameters, and anything that might pose…