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 ‘,’ 1,2,3,4,5,6,7,8,9,10 PS> (10..1) -join ‘,’ 10,9,8,7,6,5,4,3,2,1 PS> (-10..10) -join ‘,’ -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 PS> (10..-10) -join […]
Archive for April, 2018
PowerShell v6.1 Range Operator
Posted by: richardsiddaway | April 30, 2018 Comments Off on PowerShell v6.1 Range Operator |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 a test value appears in a collection of reference values OK – they’re subtly different. […]
Installing PowerShell v6.1 preview 2
Posted by: richardsiddaway | April 28, 2018 Comments Off on 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 by side with PowerShell v6.0.x Test-Connection in v6.1 PS> Get-Command Test-Connection -Syntax Test-Connection […]
Access module and functions
Posted by: richardsiddaway | April 28, 2018 Comments Off on 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 its had a number of temporary homes its permanent home is now the github repsoitory […]
PowerShell v6.1 preview 2
Posted by: richardsiddaway | April 28, 2018 Comments Off on 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 you a single string There’s now a Test-Json cmdlet and a –Not parameter has […]
ScriptBlocks Decoded
Posted by: richardsiddaway | April 28, 2018 Comments Off on 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 at https://github.com/RichardSiddaway/Summit2018ScriptBlocksDecoded The recording of the session should be on the powershell.org […]
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 it again if necessary and teach others to do the same task. By wrapping […]
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 all the tools they can think of using to try and find something that […]
CIM references and associations
Posted by: richardsiddaway | April 24, 2018 Comments Off on 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 used the Win32_NetworkAdapter class in the example because it has a known association with Win32_NetworkAdapterConfiguration. […]
Change a function definition
Posted by: richardsiddaway | April 23, 2018 Comments Off on 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 >> $y = 2 >> $x + $y >> } PS> f1 3 Our function […]
Categories
- .NET
- Active Directory
- Architecture
- Azure
- Bash
- BITS
- Books
- CDXML
- CIM
- Cloud
- COM
- Containers
- Deep Dive
- Desired State Configuration
- DevOps
- DHCP
- DNS
- DSC
- European Summit
- Events
- Exchange
- File System
- Firewall
- General
- General IT Matters
- Hyper-V
- IIS
- Infrastructure
- IT Community
- IT Security
- Learning PowerShell
- Linux
- Math
- Microsoft
- Modules
- Nano Server
- Networking
- Office 2010
- Office 2013
- Open Source
- Opinion
- Outlook
- Philosophy
- PowerShell
- PowerShell 7
- PowerShell and .NET
- PowerShell and Active Directory
- PowerShell and CIM
- PowerShell and Exchange 2007
- PowerShell and IIS
- PowerShell and SQL Server
- PowerShell and WMI
- PowerShell Basics
- PowerShell original
- PowerShell Summit
- PowerShell User Group
- PowerShell User Group 2
- PowerShell v2
- PowerShell V3
- PowerShell v4
- PowerShell v5
- PowerShell v6
- PowerShell.org
- PowerShellGet
- PowerShellV2
- PSAM
- Rant
- Registry
- Scripting
- Scripting Games
- Scripting Games 2104
- Security
- SQL Server
- Storage
- Strings
- Summit
- Technology
- Uncategorized
- Virtualization
- Windows 10
- Windows 2012 R2
- Windows 7
- Windows 8
- Windows 8 Server
- Windows 8.1
- Windows Server
- Windows server 1709
- Windows Server 2008
- Windows Server 2008 R2
- Windows Server 2012
- Windows Server 2012 R2
- Windows Server 2016
- Windows Server 2019
- WMFv5
- WPF
- WSUS