Building Better Powershell Code: Applying Proven Practices One Tip at a Time

Bertram, Adam

  • 出版商: Apress
  • 出版日期: 2020-10-20
  • 定價: $1,575
  • 售價: 9.5$1,496
  • 貴賓價: 9.0$1,418
  • 語言: 英文
  • 頁數: 146
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1484263871
  • ISBN-13: 9781484263877
  • 相關分類: Powershell
  • 立即出貨 (庫存=1)

買這商品的人也買了...

商品描述

Learn to write better PowerShell code via short, example-driven tips. This book covers tips to make your PowerShell scripts faster and easier to read all while following proven best practices. Written by a six-time Microsoft MVP and one of the first Microsoft PowerShell MVPs with over a decade of PowerShell experience, Building Better PowerShell Code gives you easily digestible tips you can begin using immediately.

The book starts with an overview of some of the most important tips the author can muster which segues into a deeper dive with dozens of examples throughout the book. It takes you through tips such as using community modules, writing better comments, thinking of PowerShell functions as building blocks, and more. You will also see how to use parameters the right way and how to create simple logging code to easily record script activity.

You will learn not only how to write better code, but also how to implement some mindset tricks, such as being explicit and specific with code and how to write code that reads well. You'll get into error handling and also how to make your scripts more secure. Finally, you'll examine the concept of building PowerShell tools and how to build scripts for speed.

Other tips and best practices include:

  • Building Pester tests
  • Improving performance through parallel processing
  • Writing cross-platform scripts
  • Using filtering properly

After reading this book and applying these tips, you will have an expert coding mindset and be able to build PowerShell code that's efficient, readable, and compliant with many best practices.

What You Will Learn

  • Implement error handling
  • Create a logging function
  • Use regular expressions to search strings
  • Implement parallel processing

Who This Book Is For

PowerShell script developers.

商品描述(中文翻譯)

這本書以短篇、以例子為驅動的方式,教你如何撰寫更好的 PowerShell 程式碼。書中介紹了一些讓你的 PowerShell 腳本更快速、更易讀的技巧,同時遵循了經過驗證的最佳實踐。作者是一位六次微軟 MVP(最有價值專家)並且是最早的 PowerShell MVP 之一,擁有超過十年的 PowerShell 經驗。《Building Better PowerShell Code》提供了易於理解的技巧,你可以立即開始應用。

本書首先概述了作者能夠提供的一些最重要的技巧,然後深入探討了書中的許多例子。書中介紹了一些技巧,例如使用社群模組、撰寫更好的註解、將 PowerShell 函數視為建構塊等等。你還將學習如何正確使用參數,以及如何創建簡單的日誌記錄程式碼,以便輕鬆記錄腳本活動。

你不僅將學習如何撰寫更好的程式碼,還將學習如何實施一些心態技巧,例如明確且具體地撰寫程式碼,以及如何撰寫易於閱讀的程式碼。你將深入研究錯誤處理,並學習如何使你的腳本更安全。最後,你將探討建立 PowerShell 工具的概念,以及如何為了速度而撰寫腳本。

其他的技巧和最佳實踐包括:
- 建立 Pester 測試
- 通過平行處理提高效能
- 撰寫跨平台腳本
- 正確使用篩選功能

閱讀完這本書並應用這些技巧後,你將擁有一個專業的編碼思維方式,能夠撰寫出高效、易讀且符合許多最佳實踐的 PowerShell 程式碼。

你將學到:
- 實施錯誤處理
- 創建日誌函數
- 使用正則表達式搜索字串
- 實現平行處理

本書適合 PowerShell 腳本開發人員閱讀。

作者簡介

Adam Bertram is a 20+ year veteran of IT and an experienced online business professional. He's a consultant, Microsoft MVP, blogger, trainer, published author and content marketer for multiple technology companies.

作者簡介(中文翻譯)

Adam Bertram是一位IT界超過20年的資深人士,也是一位經驗豐富的線上業務專業人士。他是一位顧問、Microsoft MVP、部落客、培訓師、已出版的作者,並為多家科技公司擔任內容行銷人員。