O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Windows PowerShell for .NET Developers - Second Edition

Book Description

Efficiently administer and maintain your development environment with Windows PowerShell

About This Book

  • Explore scripting and automation techniques with Windows PowerShell
  • Gain concrete knowledge of Windows PowerShell scripting to perform professional level scripting
  • Discover the benefits of the Configuration Management Platform with this step-by-step guide that includes real-world scripting examples

Who This Book Is For

If you are an IT professional or developer who has worked on the .Net platform and you want to learn automation using Windows PowerShell, then this book is for you. This self-start guide takes you from the basics and gradually moves to an intermediate level to show you how to perform professional scripting.

What You Will Learn

  • Understand the concepts of building PowerShell scripts and the basics of programming
  • Manage the LYNC, Exchange, and SharePoint platforms
  • Create a Pull server using a SMB file share and HTTP and HTTPS
  • Use .NET classes in Windows PowerShell and C# to manage Exchange Online
  • Use PowerShell in C# to manage Exchange Online and work with .NET classes in PowerShell
  • Automate LYNC clients, consuming Client Server Object Models to administrate SharePoint Online

In Detail

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.

Style and approach

This is an easy-to-follow step-by-step guide with text-enabled screenshots. Each topic is explained with codes and examples. It also includes multiple approaches for a number of tasks to let you choose the best one for you depending on your scenario.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Windows PowerShell for .NET Developers Second Edition
    1. Table of Contents
    2. Windows PowerShell for .NET Developers Second Edition
    3. Credits
    4. Foreword
    5. About the Authors
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
        3. Instant updates on new Packt books
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    9. 1. Getting Started with Windows PowerShell
      1. Scripting the cmdlet style
      2. Introducing Windows PowerShell
        1. Installing Windows Management Framework 5.0
        2. The Windows PowerShell consoles
          1. The Windows PowerShell console host
            1. Setting up the console host using GUI
            2. Setting up the console host using PowerShell
            3. Exploring the Windows PowerShell ISE host using GUI
            4. Benefits of an ISE
            5. The PowerShell ISE script browser
      3. Using an interactive shell
        1. Windows PowerShell cmdlets
        2. Getting help
        3. Understanding aliases
        4. Understanding expressions
        5. Understanding objects
        6. Understanding pipelines
          1. Exporting a running process to a CSV file
        7. Understanding filtering and formatting
          1. PowerShell formatting
          2. Exploring snippets in the PowerShell ISE
        8. Getting started with PowerShell scripting
      4. Summary
    10. 2. Unleashing Development Skills Using Windows PowerShell 5.0
      1. Basics of WMI and CIM
      2. Working with XML and COM
        1. Exploring COM and Automation
      3. Exploring .NET objects
        1. Creating .NET objects
        2. Extending .NET objects for Administrations and Development tasks
        3. Extending the .NET Framework types
        4. Building advanced scripts and modules
      4. Exploring Windows PowerShell 5.0
        1. The basics of Desired State Configuration
          1. The Authoring phase
          2. The Staging phase
          3. The "Make it so" phase
        2. Use case of classes in WMF 5.0
          1. Constructors
        3. Parsing structured objects using PowerShell
        4. Exploring Package Management
        5. Exploring PowerShellGet
      5. Understanding PowerShell modules
        1. Introduction to modules
          1. Script modules
          2. Binary modules
          3. Manifest modules
          4. Dynamic modules
      6. Script debugging
        1. Managing breakpoints
          1. Line breakpoints
          2. Variable breakpoints
          3. Command breakpoints
        2. Debugging scripts
      7. Summary
    11. 3. Exploring Desired State Configuration
      1. Prerequisites
      2. Installing the WMF 5.0 April 2015 preview
      3. Imperative versus declarative programming
      4. Getting started with DSC
        1. The Authoring phase
        2. The Staging phase
        3. The "Make it so" phase
        4. Local Configuration Manager
        5. Parameterizing the configuration script
        6. Understanding MOF
      5. Exploring Windows Remote Management and CIM
        1. Windows PowerShell remoting
        2. Exploring WSMan cmdlets
        3. HTTP/HTTPS Listener
        4. Exploring CIM commands
        5. Exploring CIM methods
        6. Querying the remote machines using CIM
      6. Creating configuration scripts
        1. Creating a configuration with MOF
        2. Creating a Class-defined DSC resource
      7. Types of deployment modes
        1. The push mode
        2. The pull mode
          1. Creating a pull server using the SMB share
          2. Creating the pull server using HTTP and HTTPS
      8. Summary
    12. 4. PowerShell and Web Technologies
      1. PowerShell Web Access
        1. Installing PowerShell Web Access
        2. Configuring PowerShell Web Access
        3. Applying authorization rules
      2. Management OData IIS Extensions
        1. Creating the Management OData web service
      3. Exploring web requests
        1. Downloading files from the Internet
        2. Reading a file from the Internet
      4. Exploring web services
        1. Using web services
        2. Building web services
      5. Exploring the REST API
        1. Using the Azure REST API in PowerShell
      6. Exploring JSON
      7. Summary
    13. 5. Exploring Application Programming Interface
      1. Exploring API using PowerShell
        1. The EWS API for managing Exchange Online
        2. Purging items in the mailbox folder
        3. Deleting items from the mailbox folder
      2. The Lync 2013 client-side API
        1. Installation of LYNC SDK
        2. Exploring client settings
        3. Automating test calls
        4. IM with contacts
      3. Client-side object model – SharePoint Online
        1. How does CSOM Work?
        2. Creating and deleting list
        3. Making PowerShell modules with SDKs
      4. Summary
    14. Index