My Account Log in

1 option

Mastering PowerShell Scripting : Automate Repetitive Tasks and Simplify Complex Administrative Tasks Using PowerShell / Chris Dent.

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Dent, Chris, author.
Series:
Expert insight.
Expert insight
Language:
English
Subjects (All):
Microsoft Windows (Computer file).
Windows PowerShell (Computer program language).
Command languages (Computer science).
Physical Description:
1 online resource (827 pages)
Edition:
Fifth edition.
Place of Publication:
Birmingham, England : Packt Publishing, [2024]
Biography/History:
Dent Chris: Chris Dent is an automation specialist with deep expertise in the PowerShell language. Chris is often found answering questions about PowerShell in both the UK and virtual PowerShell user groups. Chris has been developing in PowerShell since 2007 and has released several modules over the years.
Summary:
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, including working with parameters, objects, and .NET classes. The book covers basic and advanced topics, such as asynchronous processing, desired state configuration, managing large amounts of data, interacting with other services, and working with regular expressions and Windows Management Instrument (WMI). Discover how to efficiently use PowerShell's automation features and error-handling techniques for more complex scripts and filters. Starting with foundational knowledge, this extensive guide progresses to advanced concepts like using complex scripts and filters, asynchronous processing, desired state configuration, debugging, and error-handling techniques. You will learn how to effectively handle large data sets and interact with external services using PowerShell 7.3. Additionally, you'll discover how to fully utilize PowerShell's automation capabilities, including parsing data, manipulating regular expressions, and working with WMI using various methods.
Contents:
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
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
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
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
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
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
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
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
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
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
WQL filters and dates
Logic operators
Quoting values
WMI object paths
Using ASSOCIATORS OF
WMI type accelerators
Working with dates
Permissions
Sharing permissions
Creating a shared directory
Getting a security descriptor
Adding an access control entry
Setting the security descriptor
WMI permissions
The access mask
WMI and SDDL
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
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.
Notes:
Description based upon print version of record.
Return types and argument types
Includes bibliographical references and index.
Description based on publisher supplied metadata and other sources.
Description based on print version record.
ISBN:
9781805124153
1805124153
OCLC:
1435754725

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account