On Friday, February 24, 2017, I posted the following puzzle on Twitter and Facebook (and here!). We provide a Pester test script and a script with detailed help but no code, and you add the code to the script to make the tests pass. Special thanks to Andy Cahn at Chrysalis School in Seattle for […]
Category: Puzzle
Friday Puzzle Solution: Why doesn’t Verbose work?
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 […]
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 […]
Friday Puzzle: What does a Catch block catch?
On Friday, January 6, 2017, I posted the following puzzle on Twitter and Facebook (here, too!). It shows a Try block that encloses an expression with an intentional error and a Catch block that writes an error. But, when you run it, the error doesn’t appear as designed. The error is supposed to say ‘Cannot […]
Friday Puzzle: Phantom Help
On Friday, December 16, 2016, I posted the following puzzle on Twitter. It shows a function that has no comment-based help or XML help, but when you run Get-Help on the function, Get-Help displays both a description and notes for the function. What is the source of help for this function? I call this unintentional […]