Book Image

Windows PowerShell for .NET Developers - Second Edition

By : Chendrayan Venkatesan, Sherif Talaat
Book Image

Windows PowerShell for .NET Developers - Second Edition

By: Chendrayan Venkatesan, Sherif Talaat

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)

Creating configuration scripts

In this topic, we will take a look at how to create a configuration using the Configuration and Class keywords. Configuration creates MOF, and this MOF needs to be pushed to or pulled by the target nodes. While using class, we will define the DSC resource and deploy the configurations.

Creating a configuration with MOF

We know that DSC is a declarative syntax, and this really helps developers and IT professionals to do more. In this section, we will see what developers can do with DSC.

We have discussed a few basic concepts of DSC and its stages; using this knowledge, let's build a web server. Most organizations face operational issues: the IT professional thinks that the infrastructure is good, and the code is at fault, but on the other hand, developers state that the code works fine in test but not in production. So, test and production are not identical. To fix this gap, we can use DSC and code our infrastructure.

Let's build a test web server using DSC. In...