Mastering Windows PowerShell Scripting

 Mastering Windows PowerShell Scripting

Master the art of automating and managing your Windows environment using PowerShell

Brenton J.W. Blawat

PUBLISHING

BIRMINGHAM - MUMBAI

professional expertise distilled

Mastering Windows PowerShell Scripting

Copyright ? 2015 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: April 2015

Production reference: 1210415

Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78217-355-7

Credits

Author Brenton J.W. Blawat

Reviewers Tim Amico Christophe CR?MON Tomas Restrepo

Acquisition Editor Meeta Rajani

Content Development Editor Rohit Singh

Technical Editor Tanvi Bhatt

Copy Editors Hiral Bhat Sonia Mathur Vikrant Phadke Alpha Singh

Project Coordinator Mary Alex

Proofreaders Simran Bhogal Safis Editing Maria Gould Paul Hindle

Indexer Rekha Nair

Production Coordinator Alwin Roy

Cover Work Alwin Roy

Foreword

We all appreciate a little simplicity when it enters our busy, complicated lives. Technology is no different. In fact, that is what we expect from technology--it should simplify our lives. But it doesn't always work that way.

Sometimes technology can introduce vexing problems we don't anticipate.

With every version of Microsoft DOS and then Windows, Microsoft included separate command-line interface shells. The shell could automate some tasks, but not all of them. Some tasks had to be accomplished manually, which is antithetical-- nearly heretical--to our understanding of technology's role.

What should have been simple, automated tasks became slow, frustrating, and manual chores. That conundrum didn't go unnoticed.

Microsoft provided much-needed simplicity when it introduced PowerShell in 2006. Task automation and configuration management eliminated a great deal of timeconsuming manual work. In short, PowerShell was a game changer.

PowerShell has solved many of the command-line and scripting issues that complicated our work. It introduced simplicity. It helped organizations become more agile, more productive, and save money. PowerShell is a powerful tool, and it has demonstrated its practical value many times.

Despite its utility, though, PowerShell remains a confusing tool to many IT administrators, and the need for greater clarity remains.

It is through this lens that Mr. Brenton Blawat provides an insightful new analysis of PowerShell--a valuable guidebook for those who struggle to understand PowerShell. Others have offered narratives that attempt to explain PowerShell, but they rarely provide the roadmap, background, or context that administrators need to get from Point A to Point B.

So, this is the right time for a comprehensive new analysis.

In general terms, Mr. Blawat's book will help those who struggle to manage their compute environments. It includes important guidance on programming in PowerShell, starting with basic concepts and then introducing advanced configurations.

Mr. Blawat deconstructs and demystifies this programming language, sharing his intimate knowledge in a format that demonstrates the clarity of thought and prose that a difficult subject requires. Many authors have attempted this climb, but only Mr. Blawat has reached the summit. His examination provides relevant information for administrators who work with--and sometimes struggle with--PowerShell on a daily basis.

As Mr. Blawat explains in the following pages, the rapid adoption of cloud-based technologies paralleled the never-ending need for additional computing power in data centers. This created the need to efficiently build and expand systems with extreme precision. In addition to provisioning the base systems, there was a need to dynamically customize these new systems to work in unison with current running environments.

This drove the need for the next generation system automation languages that would provide full configuration for systems on the fly. Not only do these automation languages greatly reduce time to use, but they also ensure that no mistakes are made during the configuration process. All systems are created equally.

PowerShell is a .NET-based next generation automation language that provides both systems provisioning and management functionality for Windows-based systems. Leveraging command-line like interactions, PowerShell can be compiled into scripts that can systematically execute tasks on a system. Not limited to creating new systems, engineers are leveraging PowerShell to automate mundane tasks so that they can focus on other pressing activities in their environments.

Microsoft has fully embraced PowerShell in its full software portfolio to offer full integration with its products. Not only can you dynamically install the Microsoft software, but you can also fully manage the entire Microsoft software environment using PowerShell. PowerShell has also been embraced by third-party manufacturers through the integration of PowerShell modules. These modules provide full management capabilities for products such as network devices, storage subsystems, virtualization guests and hosts, security appliances, and other third-party applications.

Like many organizations, CDW has benefitted greatly from PowerShell, so this book hits very close to home for me. We use PowerShell scripts to manage customer environments in managed services and the installation of management tools.

We use Microsoft Orchestrator to provide back-end logic for simple user interfaces for help desk activities, like user-driven password resets and user-driven software installations. We also rely on Microsoft Orchestrator to automatically troubleshoot and remediate systems.

CDW's customers also benefit from PowerShell in myriad ways. We assist a wide variety of Fortune 500 clients to develop PowerShell automation scripts to build new systems and manage their environments, including health check scripts, systems discovery, and advanced regulatory security analysis.

Clearly, PowerShell's incredible utility has made it invaluable to CDW, our customers, and countless organizations across the globe. But understanding all of its many facets represents a daunting task. Organizations are unable to leverage PowerShell if they don't fully understand its potential.

That's where Mr. Blawat excels.

Mr. Blawat's comprehensive new work will serve as a reference tool for engineers who work with Windows by taking the mystery out of common tasks that aren't easily understood and aren't always intuitive. Diligent readers will no doubt find many more reasons to give Mr. Blawat's thorough narrative a prominent place on their bookshelves.

As Mr. Blawat's coworker, I also feel proud that he is sharing his knowledge with the world--not only so others can benefit from his experience, but so they can see what those of us who work with him at CDW witness on a daily basis.

PowerShell has proven to be an incredibly useful tool for IT administrators since it burst on to the scene. Now there is a book about PowerShell that will prove equally useful.

Jon Stevens Chief Information Officer CDW

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download