Mastering PowerShell Scripting
eBook - ePub

Mastering PowerShell Scripting

Chris Dent

Condividi libro
  1. 788 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Mastering PowerShell Scripting

Chris Dent

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

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.

]]>

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Mastering PowerShell Scripting è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Mastering PowerShell Scripting di Chris Dent in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Operating Systems. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
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...

Indice dei contenuti