Monthly Archives: April 2018

PowerShell v6.1 Range Operator

The PowerShell v6.1 Rang Operator has been enhanced to deal with letters as well as numbers. The range operator has always been available in PowerShell. It can be used to generate a range of integers for example: PS>  (1..10) -join … Continue reading

Posted in PowerShell v6 | Leave a comment

-Contains or -In

PowerShell has two operators that do very similar jobs –contains and –in. So which should you use –contains or –in. From the help file. -Contains: Tells whether a collection of reference values includes a single test value. -In: Tells whether … Continue reading

Posted in Powershell | 1 Comment

Installing PowerShell v6.1 preview 2

The MSI for installing PowerShell v6.1 preview 2 has a screen for optional actions: Add PowerShell to Path environment variable Register Windows Event Logging Manifest Enable PowerShell remoting Add ‘open here’ context menus to Explorer The 6.1 preview installs side … Continue reading

Posted in PowerShell v6 | 1 Comment

Access module and functions

A long time ago I wrote a module for working with Access databases. I also added a couple of independent functions. The  Access module and functions are now available on github. People have asked about getting the module and while … Continue reading

Posted in Powershell | Leave a comment

PowerShell v6.1 preview 2

PowerShell v6.1 preview 2 is now available for download from https://github.com/PowerShell/PowerShell/releases The breaking changes shouldn’t affect your code as they’re for telemetry and installation Test-Connection is now available in v6 Export-FormatData will pretty print the XML rather than just giving … Continue reading

Posted in PowerShell v6 | Leave a comment

ScriptBlocks Decoded

My second talk at the PowerShell Summit 2018 was ScriptBlocks Decoded. Starting from the basic explanation of what is a scriptblock and why they’re important it progressed through to proxy functions at the end. The slides and code are available … Continue reading

Posted in Powershell, Summit | 2 Comments

Troubleshooting #2

Last time I covered the PowerShell Troubleshooting pack. This time in Troubleshooting #2 I want to show you how to use Pester when troubleshooting. When you’re troubleshooting you ideally want to follow a repeatable process so that you can do … Continue reading

Posted in Powershell | 3 Comments

Troubleshooting #1

How do you go about troubleshooting a problem? There are two ends to the spectrum of solutions to troubleshooting a problem. At one end you have the click and pray brigade who will manically click round all the menus on … Continue reading

Posted in Powershell | 1 Comment

CIM references and associations

Way back in 2011, when I were just a young lad, I wrote about WMI or CIM references and associations – https://wordpress.com/read/blogs/16267735/posts/1673 ASSOCIATORS show the end point of the link between CIM classes and REFERENCES shows the linking class. I … Continue reading

Posted in PowerShell and CIM | Leave a comment

Change a function definition

Functions in PowerShell are based on scriptblocks and as I showed in my session at the recent PowerShell Summit its possible to change a function definition. Let’s start with a simple function: PS> function f1 { >>   $x = 1 … Continue reading

Posted in Powershell | Leave a comment