Mastering PowerShell Scripting Automate Repetitive Tasks and Simplify Complex Administrative Tasks Using PowerShell

Mastering PowerShell Scripting, Fifth Edition, can help you overcome any fears and become proficient in navigating PowerShell's capabilities. This edition includes new chapters on debugging, troubleshooting, and creating GUIs. You will learn about the latest features of PowerShell 7.3, includin...

Descripción completa

Detalles Bibliográficos
Otros Autores: Dent, Chris, author (author)
Formato: Libro electrónico
Idioma:Inglés
Publicado: Birmingham, England : Packt Publishing [2024]
Edición:Fifth edition
Colección:Expert insight.
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009825846706719
Tabla de Contenidos:
  • Cover
  • Copyright
  • Contributors
  • Table of Contents
  • Preface
  • Chapter 1: Introduction to PowerShell
  • Technical requirements
  • What is PowerShell?
  • The command line
  • PowerShell editors
  • Getting help
  • Updatable help
  • The Get-Help command
  • Syntax
  • Examples
  • Parameter
  • Detailed and Full switches
  • Save-Help
  • Update-Help
  • About_* help files
  • Command naming and discovery
  • Verbs
  • Nouns
  • Finding commands
  • Aliases
  • About profile scripts
  • Parameters, values, and parameter sets
  • Parameters
  • Optional parameters
  • Optional positional parameters
  • Mandatory parameters
  • Mandatory positional parameters
  • Switch parameters
  • Parameter values
  • Parameter sets
  • Common parameters
  • Confirm and WhatIf
  • Confirm and ConfirmPreference
  • WhatIf and WhatIfPreference
  • Force parameter
  • PassThru parameter
  • Introduction to providers
  • Drives and providers
  • Introduction to splatting
  • Splatting to avoid long lines
  • Conditional use of parameters
  • Splatting to avoid repetition
  • Splatting and positional parameters
  • Parser modes
  • Experimental features
  • Summary
  • Chapter 2: Modules
  • Introducing modules
  • The Get-Module command
  • The Import-Module command
  • The Remove-Module command
  • PSModulePath in PowerShell
  • Module content
  • Using Windows PowerShell modules in PowerShell 7
  • Finding and installing modules
  • What is the PowerShell Gallery?
  • The Find-Module command
  • The Install-Module command
  • The Update-Module command
  • The Save-Module command
  • Microsoft.PowerShell.PSResourceGet
  • Repositories
  • Version ranges
  • PowerShell repositories
  • Creating an SMB repository
  • NuGet repositories
  • About snap-ins
  • Summary
  • Chapter 3: Variables, Arrays, and Hashtables
  • Naming and creating variables
  • Provider variables
  • Variables in strings
  • Variable types.
  • Assignment with types on the right
  • Assignment with types on the left
  • Value and reference types
  • Type conversion
  • Variable commands
  • Get-Variable
  • New-Variable
  • Set-Variable
  • Remove-Variable
  • Clear-Variable
  • Variable provider
  • Variable scope
  • Accessing variables
  • Scope modifiers
  • Numeric scopes
  • Private variables
  • About arrays
  • Array type
  • Creation by assignment
  • Creating an array
  • Arrays with a type
  • Adding elements to an array
  • List and ArrayList
  • Selecting elements from an array
  • Changing element values in an array
  • Removing elements
  • Removing elements by index
  • Filling variables from arrays
  • Multi-dimensional and jagged arrays
  • About hashtables
  • Creating a Hashtable
  • Adding, changing, and removing keys
  • Using a hashtable to filter
  • Enumerating a Hashtable
  • About Ordered
  • Summary
  • Chapter 4: Working with Objects in PowerShell
  • Pipelines
  • Standard output
  • Non-standard output
  • The Object pipeline
  • Members
  • The Get-Member command
  • Accessing object properties
  • Access modifiers
  • Using methods
  • Return types and argument types
  • Creating and modifying objects
  • Using PSCustomObject
  • The New-Object command
  • The Add-Member command
  • Add-Member and custom objects
  • Enumerating and filtering
  • The ForEach-Object command
  • Begin and End parameters
  • The Parallel parameter
  • The MemberName parameter
  • The Where-Object command
  • Selecting and sorting
  • The Select-Object command
  • Calculated properties
  • The ExpandProperty parameter
  • The Unique parameter
  • Property sets
  • The Sort-Object command
  • The Unique parameter
  • Grouping and measuring
  • The Group-Object command
  • The Measure-Object command
  • Comparing
  • Importing, exporting, and converting
  • The Export-Csv command
  • The Import-Csv command
  • Export-Clixml and Import-Clixml.
  • The Tee-Object command
  • Formatting
  • Formatting and exporting
  • The Format-Table command
  • The Format-List command
  • Select-Object, Write-Host, and inline output
  • Format-only properties
  • Summary
  • Chapter 5: Operators
  • Precedence, grouping, and sub-expressions
  • Operator precedence
  • Grouping
  • Sub-expression operator
  • Array sub-expression operator
  • Unary, binary, and ternary operators
  • About the ternary operator
  • Arithmetic operators
  • Addition operator
  • Subtraction operator
  • Multiplication operator
  • Division operator
  • Remainder operator
  • Increment and decrement operators
  • Comparison operators
  • eq and ne
  • like and notlike
  • Greater than and less than
  • Case sensitivity
  • Comparison operators and arrays
  • Comparisons to null
  • contains and in
  • Regular expression-based operators
  • match and notmatch
  • replace
  • split
  • Logical operators
  • and
  • or
  • not
  • xor (eXclusive OR)
  • Bitwise operators
  • band (bitwise AND)
  • bor (bitwise OR)
  • bxor (bitwise eXclusive OR)
  • bnot (bitwise NOT)
  • shl and shr (shift left and right operators)
  • Assignment operators
  • Assign, add and assign, and subtract and assign
  • Multiply and assign, divide and assign, and modulus and assign
  • Statements can be assigned to a variable
  • Assignment and other operators
  • Type operators
  • as
  • is and isnot
  • Redirection operators
  • About Write-Host
  • Redirection to a file
  • PowerShell and default file encoding
  • Redirecting streams to standard output
  • Only stdout
  • Redirection to null
  • Other operators
  • Comma
  • Index
  • Range
  • Call
  • Format
  • join
  • Null coalescing
  • Null coalescing assignment
  • Null conditional
  • Pipeline chain
  • Background
  • Summary
  • Chapter 6: Conditional Statements and Loops
  • if, else, and elseif
  • Assignment within if statements
  • Implicit Boolean.
  • switch statements
  • switch statements and arrays
  • switch statements and files
  • Wildcard and Regex parameters
  • Script block cases
  • switch statements and enums
  • switch, break, and continue
  • Loops
  • foreach loop
  • foreach keyword and foreach alias
  • for loop
  • do-until and do-while loops
  • while loop
  • Loops, break, and continue
  • break and continue outside loops
  • Loops and labels
  • Loops, queues, and stacks
  • Summary
  • Chapter 7: Working with .NET
  • Assemblies
  • About the GAC
  • Types
  • Type descriptions are objects in PowerShell
  • Enumerations
  • Classes
  • Namespaces
  • The using keyword
  • Using namespaces
  • Using assemblies
  • Type accelerators
  • About PSCustomObject and Ordered
  • Members
  • Constructors
  • Properties
  • Methods
  • Fluent interfaces
  • Static methods
  • About the new() method
  • Static properties
  • Reflection in PowerShell
  • The TypeAccelerators type
  • The ArgumentTypeConverterAttribute type
  • About generics
  • Generic classes
  • Generic methods
  • Summary
  • Online Chapter
  • Chapter 10: Files, Folders, and the Registry
  • Working with providers
  • Navigating
  • Getting items
  • Drives
  • Items
  • Paths and .NET
  • Testing for existing items
  • Testing filesystem paths
  • Testing registry paths
  • Testing path type
  • Creating items
  • Reading and writing content
  • Reading and writing in a pipeline
  • Reading all content
  • Writing content
  • About text file encoding
  • Temporary files
  • Removing items
  • Invoking items
  • Item properties
  • Properties and the filesystem
  • Adding and removing file attributes
  • Registry values
  • Registry values and environment variables
  • Searching for items
  • Windows permissions
  • Access and audit
  • Rule protection
  • Inheritance and propagation flags
  • Removing ACEs
  • Copying lists and entries
  • Adding ACEs
  • Filesystem rights
  • Registry rights.
  • Numeric values in the ACL
  • Ownership
  • Transactions
  • File catalog commands
  • About hashing
  • New-FileCatalog
  • Test-FileCatalog
  • Summary
  • Chapter 11: Windows Management Instrumentation
  • Working with WMI
  • WMI classes
  • WMI commands
  • CIM commands
  • Getting instances
  • Getting classes
  • Calling methods
  • Creating instances
  • Removing instances
  • Working with CIM sessions
  • Associated classes
  • The WMI Query Language
  • Understanding SELECT, WHERE, and FROM
  • Escape sequences and wildcards
  • Comparison operators
  • WQL filters and dates
  • Logic operators
  • Quoting values
  • Associated classes
  • WMI object paths
  • Using ASSOCIATORS OF
  • WMI type accelerators
  • Getting instances
  • Working with dates
  • Getting classes
  • Calling methods
  • Creating instances
  • Associated classes
  • Permissions
  • Sharing permissions
  • Creating a shared directory
  • Getting a security descriptor
  • Adding an access control entry
  • Setting the security descriptor
  • WMI permissions
  • Getting a security descriptor
  • The access mask
  • WMI and SDDL
  • Summary
  • Chapter 12: Working with HTML, XML, and JSON
  • ConvertTo-Html
  • Multiple tables
  • Adding style
  • ConvertTo-Html and Send-MailMessage
  • Windows PowerShell and ConvertTo-Html
  • Modifying HTML content
  • XML commands
  • About XML
  • Elements and attributes
  • Namespaces
  • Schemas
  • Select-Xml
  • Select-Xml and namespaces
  • ConvertTo-Xml
  • System.Xml
  • The XML type accelerator
  • XPath and XmlDocument
  • SelectNodes and XPathNodeList
  • Working with namespaces
  • Creating XML documents
  • Modifying element and attribute values
  • Adding elements
  • Removing elements and attributes
  • Copying nodes between documents
  • Schema validation
  • Inferring a schema
  • System.Xml.Linq
  • Opening documents
  • Selecting nodes
  • Creating documents
  • Working with namespaces.
  • Modifying element and attribute values.