Book Image

Windows PowerShell for .NET Developers - Second Edition - Second Edition

Book Image

Windows PowerShell for .NET Developers - Second Edition - Second Edition

Overview of this book

Windows PowerShell 5.0 for .NET Developers is your self-start guide to performing automation using Windows PowerShell. This book will help you to understand the PowerShell syntax and grammar and will also teach you techniques to remove the rough edges of manual deployments. Packed with PowerShell scripts and sample C# codes to automate tasks, it also includes real-world scenarios such as administrating office servers to help you save time and perform deployments swiftly and efficiently. The book begins with the Windows PowerShell basics, explores the significant features of Windows Management Framework 5.0, covers the basic concepts of Desired State Configuration and the importance of idempotent deployments. By the end of the book, you will have a good understanding of Windows PowerShell’s features and will be able to automate your tasks and manage configuration effectively.
Table of Contents (13 chapters)

Installing the WMF 5.0 April 2015 preview


The latest released version of WMF 5.0 is the April 2015 preview. It's good to read the release document, refer the following link: https://www.microsoft.com/en-us/download/details.aspx?id=46889

The PowerShell team releases experimental DSC resources to configure an environment, and the latest DSC resource kit is Wave 10. Let's download this from the TechNet Gallery website (https://gallery.technet.microsoft.com/scriptcenter/DSC-Resource-Kit-All-c449312d) to install WMF 5.0 because we need the xHotfix resource to perform this action. We will discuss all about the DSC resources later in this chapter.

Note that from April 2015 onward, the DSC resource kit has been outsourced to GitHub.

The central repository for DSC resources can be found at https://github.com/powershell/DscResources.

In this example, we will install the MSU file for WMF 5.0 using DSC; to do this, we will use the Configuration keyword with the following script block:

Configuration WMF5...