Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
PowerShell 7 Workshop
PowerShell 7 Workshop

PowerShell 7 Workshop: Learn how to program with PowerShell 7 on Windows, Linux, and the Raspberry Pi

eBook
$31.99 $35.99
Paperback
$44.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

PowerShell 7 Workshop

Introduction to PowerShell 7 – What It Is and How to Get It

Quite simply, PowerShell is a time machine. Not a science-fiction time machine where you get to go back in time and meet your own grandfather, but a real, practical one. If you put in a small amount of time, then PowerShell, like any simple machine, will act as a force multiplier; it will produce very much more time for you. To use a metaphor, it’s a time hammer, and the hours you put into learning PowerShell will save you tens or hundreds of times as many hours once you start putting the knowledge to use.

This chapter is a general introduction to PowerShell 7. It’s going to give you some context about PowerShell and get you up and running. You’re going to learn what you can do with it and some typical use cases. We’ll be installing PowerShell, and you’ll get to choose one or more ways of doing that. Once we’ve got it installed, we’ll go through how you run commands (called cmdlets), and how you can find cmdlets to run. Finally, and quite importantly, we’ll work through how to get help, both with cmdlets and with PowerShell topics and concepts.

In this chapter, we’re going to cover the following main topics:

  • What is PowerShell 7?
  • What is PowerShell 7 used for?
  • Getting PowerShell 7
  • Running PowerShell 7
  • Getting help

Technical requirements

To follow along with this chapter, you will need an internet connection and an operating system. If you’re using Linux or macOS, the installation instructions can be found in Chapter 14, PowerShell 7 for Linux and macOS, so skip the detailed installation instructions in the How to get PowerShell 7 section, in this chapter.

This chapter assumes that you will be using Windows 10 (version 1709 or later) running on standard 64-bit x86 architecture. If you’re not sure whether that’s what you have, don’t worry, it probably is. If you are one of life’s worriers, go to the Windows search bar and type msinfo32, then press Enter. The System Information application will open, and under System Summary, there will be three relevant lines:

  • OS Name: Hopefully Microsoft Windows 10 of some flavor; PowerShell 7.3 is available on all currently supported versions of Windows.
  • Version: You want a build number higher than 16299.
  • System Type: Probably x64-based PC.

The following screenshot shows how it should look under System Summary:

Figure 1.1 – Typical information from the System Information application (msinfo32)

Figure 1.1 – Typical information from the System Information application (msinfo32)

If you’re using Windows 11, then good for you; you won’t need to do some of the things we’ll be talking about as Windows 11 comes with some extras.

What is PowerShell 7?

PowerShell is a scripting language and an alternative to the command-line interface. PowerShell is an automation tool consisting of (at least) three parts:

  • A shell, like the Command Prompt in Windows or the Terminal in Linux or macOS
  • A scripting language
  • A configuration management framework called Desired State Configuration (DSC)

In practice, when we talk about PowerShell, we’re usually talking about the scripting language. Usage of the shell is largely intuitive to the user, as we’ll see, and while we’ll talk about DSC later, in my experience, most people don’t use it as much as they should.

The first version of PowerShell grew out of a project called Monad, which was an attempt by Jeffrey Snover to replicate Unix tools on Windows. He realized that one of the fundamental drawbacks of Unix tools is that they output a bytestream (usually text), and so a lot of effort is wasted on searching, formatting, and extracting the output of commands before you can act on that output. Monad was written to output objects that could be input straight into another command. We’ll cover this in more detail when we get to Chapter 4, PowerShell Variables and Data Structures. PowerShell 1.0 was released in 2006, but in my opinion, it didn’t really take off until PowerShell 2.0 was released in 2009, and Microsoft started re-engineering the administrative interfaces of major pieces of software such as Exchange Server 2010 to make use of it. Other opinions are available.

At the time of writing, there are two main flavors of PowerShell: Windows PowerShell, which comes bundled with both server and desktop versions of Windows, and PowerShell 7, which must be downloaded and installed. The latest (and allegedly final) version of Windows PowerShell, v5.1, is built on .NET Framework 4.5, the proprietary software framework that is bundled with Windows and underpins many of Microsoft’s products. PowerShell 7.0 was built on .NET Core 3.1, a simplified, open source implementation of .NET. However, since version 7.2, PowerShell has been built on .NET 6.0. This unified version of .NET is a replacement for both .NET Framework and .NET Core, and was released in November 2020.

Because of the fundamental differences between Windows PowerShell 5.1 and PowerShell 7.x, there can be some differences in how they work on the Windows platform. These will be discussed in Chapter 13, Working With PowerShell 7 and Windows.

We’ll find it useful to summarize some of the key differences in the following table:

Parameters

Windows PowerShell

PowerShell 7.2

Platform

x64, x86 only

x64, x86, arm32, arm64

OS

Windows

Windows, Linux, macOS

.NET Version

.NET Framework 4.5

.NET 6.0

License Type

Proprietary

Open source

No. of Native Commands

1588 (in vanilla Windows 10)

1574 (in vanilla Windows 10)

290 (in Ubuntu 20.04)

Table 1.1 – Some differences between Windows PowerShell and PowerShell 7

In this section, we have covered what PowerShell is, and how it differs from Windows PowerShell. In the next section, we’ll look at why PowerShell 7 exists and see what makes it special.

Left arrow icon Right arrow icon

Key benefits

  • Master the art of coding with Microsoft’s free, open-source cross-platform language
  • Understand essential programming concepts such as loops and objects through practical examples
  • Practice using PowerShell 7 with websites, APIs, and physical computing devices like Raspberry Pi
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

Discover the capabilities of PowerShell 7 for your everyday tasks with this carefully paced tutorial that will help you master this versatile programming language. The first set of chapters will show you where to find and how to install the latest version of PowerShell, providing insights into the distinctive features that set PowerShell apart from other languages. You’ll then learn essential programming concepts such as variables and control flow, progressing to their applications. As you advance, you’ll work with files and APIs, writing scripts, functions, and modules. You’ll also gain proficiency in securing your PowerShell environment before venturing into different operating systems. Enriched with detailed practical examples tailored for Windows, Linux, macOS, and Raspberry Pi, each chapter weaves real-world scenarios to ignite your imagination and cement the principles you learn. You’ll be able to reinforce your understanding through self-assessment questions and delve deeper into the principles using comprehensive reading lists. By the end of this book, you’ll have the confidence to use PowerShell for physical computing and writing scripts for Windows administration.

Who is this book for?

This book uses everyday language to explain concepts and has simple examples to explain complex principles. It is suitable for early careers IT professionals, architects, system engineers, secondary school pupils and university students, who are interested in learning this powerful language. 

What you will learn

  • Grasp the distinctive object-oriented nature of PowerShell 7
  • Explore the practical applications of standard programming concepts, such as control flow
  • Find out how to interact with websites and APIs
  • Implement best practices to secure your PowerShell environment and write secure code
  • Get to grips with writing scripts, functions, and modules
  • Develop the skills to troubleshoot your code
  • Deploy PowerShell on various operating systems

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 29, 2024
Length: 468 pages
Edition : 1st
Language : English
ISBN-13 : 9781801817493
Vendor :
Microsoft
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Feb 29, 2024
Length: 468 pages
Edition : 1st
Language : English
ISBN-13 : 9781801817493
Vendor :
Microsoft
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 139.97
The Ultimate Kali Linux Book
$54.99
Mastering PowerShell Scripting
$39.99
PowerShell 7 Workshop
$44.99
Total $ 139.97 Stars icon

Table of Contents

22 Chapters
Part 1: PowerShell Fundamentals Chevron down icon Chevron up icon
Chapter 1: Introduction to PowerShell 7 – What It Is and How to Get It Chevron down icon Chevron up icon
Chapter 2: Exploring PowerShell Cmdlets and Syntax Chevron down icon Chevron up icon
Chapter 3: The PowerShell Pipeline – How to String Cmdlets Together Chevron down icon Chevron up icon
Chapter 4: PowerShell Variables and Data Structures Chevron down icon Chevron up icon
Chapter 5: PowerShell Control Flow – Conditionals and Loops Chevron down icon Chevron up icon
Chapter 6: PowerShell and Files – Reading, Writing, and Manipulating Data Chevron down icon Chevron up icon
Chapter 7: PowerShell and the Web – HTTP, REST, and JSON Chevron down icon Chevron up icon
Part 2: Scripting and Toolmaking Chevron down icon Chevron up icon
Chapter 8: Writing Our First Script – Turning Simple Cmdlets into Reusable Code Chevron down icon Chevron up icon
Chapter 9: Don’t Repeat Yourself – Functions and Scriptblocks Chevron down icon Chevron up icon
Chapter 10: Error Handling – Oh No! It’s Gone Wrong! Chevron down icon Chevron up icon
Chapter 11: Creating Our First Module Chevron down icon Chevron up icon
Chapter 12: Securing PowerShell Chevron down icon Chevron up icon
Part 3: Using PowerShell Chevron down icon Chevron up icon
Chapter 13: Working with PowerShell 7 and Windows Chevron down icon Chevron up icon
Chapter 14: PowerShell 7 for Linux and macOS Chevron down icon Chevron up icon
Chapter 15: PowerShell 7 and the Raspberry Pi Chevron down icon Chevron up icon
Chapter 16: Working with PowerShell and .NET Chevron down icon Chevron up icon
Answers to Activities and Exercises Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.7
(3 Ratings)
5 star 66.7%
4 star 0%
3 star 0%
2 star 0%
1 star 33.3%
james honeycutt Jun 19, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
**Book Review: PowerShell Mastery**As an avid PowerShell user, instructor of multiple PowerShell classes, and a reader of numerous PowerShell books, I can confidently say that "PowerShell Mastery" has something for everyone. Whether you are a beginner or an experienced user, this book provides valuable insights and practical knowledge that can enhance your PowerShell skills.The book excels in its clarity and approachability. It explains complex topics in an easy and understandable manner, making it accessible for those who are new to PowerShell. Each concept is broken down into manageable sections, complete with examples and exercises that reinforce the material. This thoughtful structure ensures that readers can grasp the basics quickly and build a solid foundation.For more seasoned PowerShell users, "PowerShell Mastery" delves into advanced topics with remarkable depth. The book covers seldomly used but highly useful features that are often overlooked in other resources. This comprehensive coverage is particularly beneficial for those looking to expand their expertise and explore the full potential of PowerShell.One of the most notable aspects of "PowerShell Mastery" is its inclusion of topics that are rarely covered in other PowerShell books. For instance, the book provides an in-depth look at PowerShell JEA (Just Enough Administration), a powerful feature that enhances security by allowing specific administrative tasks without granting full administrative privileges. The detailed coverage of JEA, along with practical examples, sets this book apart and offers invaluable insights into securing your PowerShell environment.The author's ability to present advanced concepts without overwhelming the reader is commendable. Topics such as scripting automation, error handling, and module creation are explained with precision and clarity. These sections are enriched with practical examples and real-world scenarios, making the content highly relevant and applicable.One of the standout features of "PowerShell Mastery" is its emphasis on best practices and efficient coding techniques. The author shares valuable tips and tricks that can save time and improve the efficiency of your scripts. This focus on practical application sets the book apart and makes it an indispensable resource for both personal and professional use.In conclusion, "PowerShell Mastery" is a must-have for anyone interested in PowerShell, regardless of their skill level. Its clear explanations, in-depth coverage of advanced topics, and focus on practical application make it an exceptional resource. Whether you are just starting out or looking to deepen your PowerShell knowledge, this book will undoubtedly enhance your understanding and proficiency.
Amazon Verified review Amazon
Steve M. Mar 05, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I can't remember the last time that I bought a paper tech book (I guess I could search my order history, but I'm here now).I've been using PowerShell since it was first released in, what, 2006? I've been developing with .NET since its beta in 1999 (jeez!) and PowerShell brought the capabilities that I was enjoying to a rich and powerful command line. I've developed a fair few PowerShell Cmdlets, back in the day. Of course, I was stuck on Windows back then. My background is originally in mainframes, but I spent many, many years developing on and for Windows (and I liked it). But once .NET went cross-platform and PowerShell went with it, I could have the power of PowerShell on Linux and MacOS, too. It never occured to me to try it on Raspberry Pi until now, though...I say I've been using PowerShell, but I never really mastered it. Just enough to get the job done, really. This book is encouraging me to go deeper. It starts off with the basics, of course, but soon gets into interesting territory that I've never really thought about. The author's style is a good balance of relaxed and chatty with a good amount of detail. It makes for easy reading, which I find encourages me to read on. That's where holding a physical book makes a difference; I can carry it around the house (it's a more productive way to spend time in 'the smallest room' than scrolling on the phone), I can turn over the corners and make pencil notes (yes, I really do dog ear my books) while I work through it at a leisurely pace. I like to learn. I'm learning something new all the time and for now, it's PowerShell 7. I might even be encouraged to buy another book after this.
Amazon Verified review Amazon
Glen M. Green Jul 24, 2024
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
amazon prime day said 9x rewards points for this and two other books. Never received ANY points for them...missing roughly 559 pts. customer support says, you "just have to wait". it's been 8 days, 3 phone calls, 4 chat sessions and STILL NOTHING!!! Don't bother with kindle rewards!!!!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.