Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying PowerShell 7 Workshop
  • Table Of Contents Toc
  • Feedback & Rating feedback
PowerShell 7 Workshop

PowerShell 7 Workshop

By : Nick Parlow
3.7 (3)
close
close
PowerShell 7 Workshop

PowerShell 7 Workshop

3.7 (3)
By: Nick Parlow

Overview of this book

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.
Table of Contents (23 chapters)
close
close
1
Part 1: PowerShell Fundamentals
9
Part 2: Scripting and Toolmaking
15
Part 3: Using PowerShell

Chapter 3

Activities

  1. We can combine -first, -last, and -skip to do this, like so:
    1,2,3,4,5,6,7,8 | Select-Object -last 2 -First 3 -skip 1

    If we read the help file carefully, we will see that the -skip parameter will skip from the start, unless it is combined with -last. However, it is not positional, so if we specify both the -first and -last parameters, -skip will always skip from the start of the array; it doesn’t matter where we put it in the cmdlet:

Figure A.3 – Output when we use first, last, and skip

Figure A.3 – Output when we use first, last, and skip

  1. This is because -contains doesn’t support wildcards. The value must match exactly, except that it is not case sensitive.
  2. Get-Command -ParameterName filter will do this for us. If you run it, you will see that there are lots of them. Most of them make use of the same filter block syntax we’ve been looking at in this chapter.

Exercises

  1. Get-Date | Select-Object DayOfWeek

    First, we need to know...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY