It's been since 2009 that I am using Powershell as my favourite administration tool and I must admit it has never evolved as fast as this year. A full bunch of new products and of interesting concepts are born and growing fast both in the language itself and in its surroudings, making it one of the key competence to have in the Windows IT world nowadays.
Beside this, Microsoft is pushing its Windows development as fast as it can, and the release of Windows 10 (and of its Server version), with its ton of new cmdlets, is a clear sign of the fact that people in Redmond are doing their best to build on the success of Powershell.
On top of this, the community is strongly focusing on making Powershell (which is a tool built for sysadmins and aimed at system administration) take advantage of well established software development processes like Test-Driven Development (TDD). The star on stage here is named Pester, a project started by Scott Muc a few years back, which is a Unit-Testing solution for your Powershell code.
Last but not least, by now you should have heard of Desired State Configuration, which, starting with Windows 2012 R2 and Powershell 4.0, is a configuration management solution aimed at preventing configuration drift in your environment. In a few words, DSC provides a set of PowerShell language extensions, in the form of new Windows PowerShell cmdlets, that you can use to declaratively specify how you want your environment to be configured. Talking of DSC with your colleagues, you will hear a lot about the concept of idempotency, which, to make it simple, is the way DSC ensures that the environment desired state will be reached by applying the entire configuration, regardless of the current state.
I am currently having fun testing all of this, and, let me tell you, if you are new to Powershell, it's time to get a grasp on it before it is too late.
To stimulate your curiosity, heres' some screenshots from my current labs.
Here you can see that in Windows 10 the Start button is back:
Same for the Server version:
Both come with Powershell 5.0, the ultimate version:
Installing Pester on Windows 10 is now a breeze, thanks to the Package Manager I have already talked of in a previous blog post. Just run
Find-Package Pesterto check which version is available (version 3.1.1 at the time of testing), then:
Install-Package Pesterand you'll get it installed.
Here's a screenshot of the full installation process:
The Pester module will appear in you Module folder:
These are the cmdlets it comes with (I'll come back on them in a future post):
Get-Command -Module Pester CommandType Name Version Source ----------- ---- ------- ------ Function AfterEach 3.1.1 Pester Function Assert-MockCalled 3.1.1 Pester Function Assert-VerifiableMocks 3.1.1 Pester Function BeforeEach 3.1.1 Pester Function Context 3.1.1 Pester Function Describe 3.1.1 Pester Function Get-MockDynamicParameters 3.1.1 Pester Function Get-TestDriveItem 3.1.1 Pester Function In 3.1.1 Pester Function InModuleScope 3.1.1 Pester Function Invoke-Mock 3.1.1 Pester Function Invoke-Pester 3.1.1 Pester Function It 3.1.1 Pester Function Mock 3.1.1 Pester Function New-Fixture 3.1.1 Pester Function Set-DynamicParameterVariables 3.1.1 Pester Function Setup 3.1.1 Pester Function Should 3.1.1 Pester
So now, there are a lot of new things to learn out there. It's time for you to start having a look at all of this and that's why I am giving you a short list of recent and interesting blog posts to start from.
- A post by fellow MVP Richard Siddaway on the reasons to upgrade to the most recent Powershell version
- An introduction to using Pester for Test-Driven Development in Powershell by fellow MVP Mike F Robbins
- A very well written post on how to write a Custom DSC resource by fellow MVP Fabien Dibot
- A brilliant article on Powershell.org by fellow MVP Don Jones titled DSC: Must-Have or just Nice-To-Have
- The Pester story, by its inventor, Scott MUC