Mastering PowerShell Scripting
eBook - ePub

Mastering PowerShell Scripting

Chris Dent

Buch teilen
  1. 788 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Mastering PowerShell Scripting

Chris Dent

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

This complete guide takes you on a tour of PowerShell from the basics to its advanced functionality, helping you automate your tedious and time-consuming system admin tasks

Key Features

  • Automate complex tasks, manipulate data, and secure your environment
  • Work with dual code for PowerShell 7 and Windows PowerShell to maintain compatibility with older versions
  • See PowerShell in action, from learning the fundamentals to creating classes, scripts, and modules

Book Description

PowerShell scripts offer a convenient way to automate various tasks, but working with them can be daunting. Mastering PowerShell Scripting takes away the fear and helps you navigate through PowerShell's capabilities.This extensively revised edition includes new chapters on debugging and troubleshooting and creating GUIs (online chapter). Learn the new features of PowerShell 7.1 by working with parameters, objects, and.NET classes from within PowerShell 7.1.This comprehensive guide starts with the basics before moving on to advanced topics, including asynchronous processing, desired state configuration, using more complex scripts and filters, debugging issues, and error-handling techniques. Explore how to efficiently manage substantial amounts of data and interact with other services using PowerShell 7.1. This book will help you to make the most of PowerShell's automation features, using different methods to parse data, manipulate regular expressions, and work with Windows Management Instrumentation (WMI).

What you will learn

  • Optimize code with functions, switches, and looping structures
  • Test and debug your scripts as well as raising and catching errors
  • Work with objects and operators to test and manipulate data
  • Parse and manipulate different data types
  • Use jobs, runspaces, and runspace pools to run code asynchronously
  • Write.NET classes with ease within PowerShell
  • Create and implement regular expressions in PowerShell scripts
  • Make use of advanced techniques to define and restrict the behavior of parameters

Who this book is for

This book is for system administrators who want to automate and speed up their processes using PowerShell and Windows PowerShell. You'll need to know the basics of operating systems, but beginners with no prior experience with PowerShell will have no trouble following along.

]]>

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Mastering PowerShell Scripting als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Mastering PowerShell Scripting von Chris Dent im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Computer Science & Operating Systems. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2021
ISBN
9781800208575

4

Operators

In programming, an operator is an object that is used to manipulate an item of data. Operations include comparing values, performing replacement and split operations, mathematical operations, bitwise operations, and so on. An operator is a fundamental part of any programming language and PowerShell is no exception.
PowerShell has a wide variety of operators; each one is explored within this chapter.
This chapter covers the following topics:
  • Arithmetic operators
  • Assignment operators
  • Comparison operators
  • Regular expression-based operators
  • Logical operators
  • Binary operators
  • Type operators
  • Redirection operators
  • Other operators

Arithmetic operators

Arithmetic operators are used to perform numeric calculations. The arithmetic operators in PowerShell are as follows:
  • Addition: +
  • Subtraction: -
  • Multiplication: *
  • Division: /
  • Remainder: %
As well as its use in numeric calculations, the addition operator may also be used with strings, arrays, and hashtables, and the multiplication operator may also be used with strings and arrays.
The following sections explore each of the operators listed previously.

Operator precedence

Operations are executed in a specific order depending on the operator used. For example, consider the following two simple calculations:
3 + 2 * 2 2 * 2 + 3 
The result of both preceding expressions is 7 (2 multiplied by 2, then add 3) because the multiplication operator has higher precedence than the addition operator.
PowerShell includes a help document describing the precedence for each operator:
Get-Help about_Operator_Precedence 
The help topic lists the operators in the order they are evaluated. The multiplication operator, *, is higher precedence (higher in the list) than addition, +; therefore, in an operation using both operators, * is calculated first.
Expressions in brackets have the highest precedence and are therefore always calculated before any other. Brackets may be used to group expressions together in cases where the default operator precedence would give an incorrect result:
(3 + 2) * 2 
The result of the preceding calculation is 10; the expression in brackets is calculated first, giving 5, and the result of that is multiplied by 2.

Addition and subtraction operators

The addition and subtraction operators, + and -, are most easily recognizable as arithmetic operators. The addition operator also serves as a concatenation operator.

Addition operator

The addition operator may be used to add numeric value...

Inhaltsverzeichnis