On Friday, February 17, 2017, I posted the following puzzle on Twitter and Facebook (and here!). It shows a PowerShell function with a Write-Verbose command and asks “Why won’t this verbose string print?” You might think of this as a beginner puzzle, but after years of using PowerShell, I still hit this issue occasionally, and […]
Tag: juneb
Friday Puzzle Solution: What does Return keyword return?
On Friday, February 3, we posted a Friday Puzzle that shows a PowerShell function and a PowerShell class method that contain the same command sequence, including a statement with the Return keyword. The puzzle asks: What does the function return? What does the class method return? And, of course, we want to understand why. To […]
Friday Puzzle: Why doesn’t Include include?
On Friday, January 20, 2017, I posted the following puzzle on Twitter and Facebook (and here!). It shows a Get-ChildItem command where the value of the Path parameter is $PSHome, the Windows PowerShell installation directory, and the value of the Include parameter is ‘*ps1xml.’ The command returns nothing — not a single file — even […]
Starting a PowerShell User Group: An interview with Gary Barnes
Have you ever wondered what it would be like to start a PowerShell user group? I did an interview with Gary Barnes, Software Development Engineer in Test, Portland, Oregon, who just started PDX PowerShell (@PDXPoShPUG), a PowerShell user group for Portland, OR, USA, and its suburbs, including Vancouver, WA. He has lots of great insights. […]
Write a Multi-Form PowerShell GUI App
Tested on: PowerShell 2.0+, PowerShell Studio 2016 This step-by-step example shows you how to create a very simple multi-form PowerShell GUI app. The app consists of a parent form that gets data from a child form and displays it. When you finish, you’ll know how to use the basic multi-form features of PowerShell Studio. For […]
Using a ModuleSpecification Object
With the advent of side-by-side module versions in Windows PowerShell 5.0, the lovely, but obscure ModuleSpecification object has become your new best friend. Use it to make sure that the commands and module that you use are the ones that you intend. Using ModuleSpecification Let’s start with an example. I want to get the Expand-Archive […]
Which PowerShell Versions are Users Running?
In March 2016, SAPIEN Technologies, Inc. posted a survey asking users and administrators which versions of Windows PowerShell they’re running. We got 148 responses by the April 8 when we closed the survey. This blog post reports the findings. While reading them, please keep in mind that this is not a statistically valid survey. We […]
How to Pass Parameters to a Pester Test Script
Applies to Pester 3.4.0 Like any Windows PowerShell script, a script that contains Pester tests can include parameters. It’s easy enough to run the script and pass parameters and values in the usual way. But, when you use Invoke-Pester to run the script, you need to pass the parameters in a hash table. This blog […]
Invoke-Pester: Running Selected Tests
Applies to: Pester 3.4.0 In How to Run Pester Tests, I talked about the different places that you can put your Pester days and the different ways to run them, including, but not limited to, the Invoke-Pester function. Today, I’ll talk about the parameters of Invoke-Pester function that let you determine which tests run. Next, […]
How to Run a Pester Test
Applies to: Pester 3.4.0 When you crack open the Pester module, you find the New-Fixture function, which creates a script and test file pair, and the Invoke-Pester function, which runs Pester tests. But New-Fixture is not the only way to create a Pester test and Invoke-Pester is not the only way to run a test. […]