Take advantage of everything Microsoft’s new PowerShell 7 has to offer
PowerShell 7 for IT Pros is your guide to using PowerShell 7, the open source, cross-platform version of Windows PowerShell. Windows IT professionals can begin setting up automation in PowerShell 7, which features many improvements over the early version of PowerShell Core and Windows PowerShell. PowerShell 7 users can enjoy the high level of compatibility with the Windows PowerShell modules they rely on today. This book shows IT professionals - especially Windows administrators and developers - how to use PowerShell7 to engage in their most important tasks, such as managing networking, using AD/DNS/DHCP, leveraging Azure, and more.
To make it easy to learn everything PowerShell 7 has to offer, this book includes robust examples, each containing sample code so readers can follow along. Scripts are based on PowerShell 7 running on Windows 10 19H1 or later and Windows Server 2019.
• Learn to navigate the PowerShell 7 administrative environment
• Use PowerShell 7 to automate networking, Active Directory, Windows storage, shared data, and more
• Run Windows Update, IIS, Hyper-V, and WMI and CIM cmdlets within PowerShell 7
• Understand how to handle reporting in the new PowerShell 7 environment
PowerShell 7 for IT Pros provides exclusive coverage of using PowerShell with both cloud-based systems and virtualized environments (Hyper V and Azure). Written by PowerShell veteran Thomas Lee, this is the only book you’ll need to get started with PowerShell 7.
Table of Contents
Foreword xiii
Introduction xxxiii
Chapter 1 Setting Up a PowerShell 7 Environment 1
What is New in PowerShell 7 2
Systems Used in This Book and Chapter 3
Installing PowerShell 7 5
Installing and Configuring VS Code 14
Using the PowerShell Gallery 21
Creating a Local PowerShellGet Repository 24
Creating a Code-Signing Environment 30
Summary 35
Chapter 2 PowerShell 7 Compatibility with Windows PowerShell 37
Examining PowerShell Modules 38
Introducing the Compatibility Solution 48
Things That Do Not Work with PowerShell 7 51
Summary 54
Chapter 3 Managing Active Directory 55
Systems Used in This Chapter 58
Establishing a Forest Root Domain 60
Installing a Replica DC 66
Installing a Child Domain 70
Configuring a Cross-Forest Trust 75
Managing AD Users, Computers, and OUs 86
Adding Users to AD via a CSV 96
Configuring Just Enough Administration (JEA) 100
Summary 109
Chapter 4 Managing Networking 111
Systems Used in This Chapter 112
Configuring IP Addressing 113
Testing Network Connectivity 117
Installing the DHCP Service 121
Configuring DHCP Scopes 124
Configuring DHCP Failover 128
Configuring the DNS Service 133
Configuring DNS Zones and Resource Records 138
Summary 144
Chapter 5 Managing Storage 145
Systems Used in This Chapter 146
Managing Disks and Volumes 147
Managing NTFS Permissions 154
Managing Storage Replica 163
Managing Filestore Quotas 175
Managing File Screening 183
Summary 190
Chapter 6 Managing Shared Data 191
Systems Used in This Chapter 193
Setting Up and Securing an SMB File Server 194
Creating and Securing SMB Shares 198
Creating and Using an iSCSI Target 207
Setting Up a Clustered Scale-Out File Server 218
Summary 229
Chapter 7 Managing Printing 231
Systems Used in This Chapter 232
Installing and Sharing Printers 233
Publishing a Printer in AD 238
Changing the Spool Folder 240
Printing a Test Page 245
Creating a Printer Pool 248
Summary 249
Chapter 8 Managing Hyper-V 251
Systems Used in This Chapter 253
Installing and Configuring Hyper-V 254
Creating a Hyper-V VM 257
Using PowerShell Direct 262
Configuring VM Networking 265
Configuring VM Hardware 271
Implementing Nested Virtualization 277
Using VM Checkpoints 282
Using VM Replication 291
Managing VM Movement 305
Measuring VM Resource Usage 311
Summary 314
Chapter 9 Using WMI with CIM Cmdlets 315
Exploring WMI Namespaces 320
Exploring WMI Classes 328
Getting Local and Remote Objects 330
Invoking WMI Methods 334
Managing WMI Events 339
Implementing Permanent WMI Event Handling 347
Summary 355
Chapter 10 Reporting 357
Systems Used in This Chapter 358
Reporting on AD Users and Computers 359
Managing Filesystem Reporting 365
Collecting Performance Information Using PLA 374
Reporting on PLA Performance Data 379
Creating a Performance Monitoring Graph 382
Creating a System Diagnostics Report 385
Reporting on Printer Usage 387
Creating a Hyper-V Status Report 390
Reviewing Event Logs 395
Summary 402
Index 403