Mastering PowerShell Scripting
eBook - ePub

Mastering PowerShell Scripting

Chris Dent

Partager le livre
  1. 788 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Mastering PowerShell Scripting

Chris Dent

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

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.

]]>

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Mastering PowerShell Scripting est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Mastering PowerShell Scripting par Chris Dent en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Computer Science et Operating Systems. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
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...

Table des matiĂšres