Adam Bertram

Building Better PowerShell Code

Applying Proven Practices One Tip at a Time

1st ed.
Adam Bertram
Evansville, IN, USA
ISBN 978-1-4842-6387-7e-ISBN 978-1-4842-6388-4
© Adam Bertram 2020
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Distributed to the book trade worldwide by Springer Science+Business Media LLC, 1 New York Plaza, Suite 4600, New York, NY 10004. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.

This book is dedicated to all of the tech professionals out there that have been intrigued by PowerShell and have taken the time to dig in, learn, and better themselves with knowledge.

Introduction

This book was created out of necessity. There are many books out there on how to learn PowerShell. You’ll also find thousands of articles and blog posts on PowerShell best practices. But there wasn’t an entire collection of PowerShell learning and best practices brought together before.

Each chapter in this book is broken down by chapter with multiple “tips” inside. Each chapter is a bucket for the kinds of tips you can expect to read about. Each tip is a best practice. Tips are short, actionable steps you can take today to help you improve your PowerShell scripts.

Tips do not go into major detail. There are other resources out there for that. The tips in this book are not meant to be exhaustive how-tos but to rather act as a checklist for actions to take. With each tip, you will typically find an example to solidify your understanding of the tip.

All tips within this book should be treated as universal across all PowerShell versions and platforms from Windows PowerShell 5.1 and later including all PowerShell Core versions. If you see an example using code, assume that it will work in your PowerShell version of choice. All examples were written to be as generic as possible.

All tips in this book were written by me, but many were contributed by the PowerShell community. If a tip did come from the community, the community member will be referenced.

Who Is This Book For?

This book is for anyone wanting to learn how to write better PowerShell code. The book’s examples are primarily targeted to the IT professional, although anyone writing PowerShell for any purpose can get a lot from this book.

This book is not meant to be “training,” per se. It’s not specifically targeted at any level of PowerShell expertise. You will find tips in this book ranging from the basic level all the way up to the advanced level. It’s up to you to skip those tips that don’t apply to you and soak up the ones that do.

Read over this book periodically throughout your career. You’ll find that each tip will vary based on specific contexts, use cases, and expertise levels. Once you find yourself at that level, you’ll be able to understand and get more out of those tips.

Book Resources

You will find all code referenced in this book in the (a) GitHub repository called PowerShellTipsTo​WriteBy.

Acknowledgments

This book, along with all of my other career projects, could not have been possible without my wife, Miranda. She’s the rock of our household and has allowed me to pursue projects regardless of how crazy they have been and has supported me for nearly 20 years now.

I also want to acknowledge all of those that have reached out and let me know how much my work means to you. It may mean a lot to you, but trust me, it means more to me to hear stories of how I’ve helped throughout your career.

Table of Contents
Index 143
About the Author
Adam Bertram
../images/501963_1_En_BookFrontmatter_Figb_HTML.jpg

is a 22-year veteran of IT and experienced online business professional. He’s an entrepreneur, Microsoft MVP, blogger at adamtheautomator.com, trainer, and writer for multiple technology companies. Catch up on Adam’s articles at adamtheautomator.com, connect on linkedin.com/in/AdamBertram/, or follow him on twitter.com/adbertram.

 
About the Technical Reviewer
Vikas Sukhija
../images/501963_1_En_BookFrontmatter_Figc_HTML.jpg
has over 16 years of IT infrastructure experience. He is certified/worked on various Microsoft and related technologies.

He has been awarded five times with Microsoft Most Valuable Professional title (thrice in Cloud and Datacenter management (PowerShell) and twice in the Office 365 category).

With his experience on messaging and collaboration technologies, he has assisted clients in migrating from one messaging platform to another.

He has utilized PowerShell for automation of various monotonous tasks as well as created self-service solutions for users.

He has been recognized many times by clients for automations that resulted in direct/indirect cost avoidance.

He is playing key roles with various large clients in the implementation and adoption of Office 365.

He is the owner and author of the http://TechWizard.cloud ,http://SysCloudPro.comblog site.

He is also the owner and author of the https://www.facebook.com/TechWizard.cloud Facebook page.

 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.160.154