Skip to main content
TopMiniSite

Back to all posts

How to Create an Empty Array Of Arrays In Powershell?

Published on
2 min read
How to Create an Empty Array Of Arrays In Powershell? image

Best Scripting Tools to Buy in October 2025

1 Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

BUY & SAVE
$47.34 $59.99
Save 21%
Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools
2 Beginner’s Guide to PowerShell Scripting: Automate Windows Administration, Master Active Directory, and Unlock Cloud DevOps with Real-World Scripts and Projects

Beginner’s Guide to PowerShell Scripting: Automate Windows Administration, Master Active Directory, and Unlock Cloud DevOps with Real-World Scripts and Projects

BUY & SAVE
$0.99
Beginner’s Guide to PowerShell Scripting: Automate Windows Administration, Master Active Directory, and Unlock Cloud DevOps with Real-World Scripts and Projects
3 PowerShell Advanced Cookbook: Enhance your scripting skills and master PowerShell with 90+ advanced recipes (English Edition)

PowerShell Advanced Cookbook: Enhance your scripting skills and master PowerShell with 90+ advanced recipes (English Edition)

BUY & SAVE
$37.95
PowerShell Advanced Cookbook: Enhance your scripting skills and master PowerShell with 90+ advanced recipes (English Edition)
4 The PowerShell Scripting & Toolmaking Book: Author-Authorized Second Edition

The PowerShell Scripting & Toolmaking Book: Author-Authorized Second Edition

BUY & SAVE
$29.99
The PowerShell Scripting & Toolmaking Book: Author-Authorized Second Edition
5 Learn PowerShell Scripting in a Month of Lunches

Learn PowerShell Scripting in a Month of Lunches

BUY & SAVE
$34.99
Learn PowerShell Scripting in a Month of Lunches
6 Trend EasyScribe Scribing Tool, Accurate Scribing Solution for Carpenters, Joiners, Tilers, Kitchen & Shop Fitters, E/SCRIBE, Black

Trend EasyScribe Scribing Tool, Accurate Scribing Solution for Carpenters, Joiners, Tilers, Kitchen & Shop Fitters, E/SCRIBE, Black

  • VERSATILE TOOL FOR SCRIBING DOORS, FLOORING, AND MORE-PERFECT FIT EVERY TIME.
  • ADJUSTABLE OFFSET FROM 0.04 TO 1.57 FOR ULTIMATE FLEXIBILITY IN TASKS.
  • ULTRA-THIN GUIDE PLATE EASILY FITS NARROW GAPS FOR PRECISE INSTALLATIONS.
BUY & SAVE
$31.99
Trend EasyScribe Scribing Tool, Accurate Scribing Solution for Carpenters, Joiners, Tilers, Kitchen & Shop Fitters, E/SCRIBE, Black
7 Milescraft 8407 ScribeTec - Scribing and Compass Tool

Milescraft 8407 ScribeTec - Scribing and Compass Tool

  • ARTICULATING HEAD FOR TACKLING COMPLEX ANGLES WITH EASE.
  • SPRING-LOADED, RETRACTABLE POINT ENSURES PRECISION AND CONTROL.
  • VERSATILE GRIP FITS VARIOUS PENCILS AND MARKERS FOR FLEXIBILITY.
BUY & SAVE
$10.49 $10.99
Save 5%
Milescraft 8407 ScribeTec - Scribing and Compass Tool
8 Scripting: Automation with Bash, PowerShell, and Python—Automate Everyday IT Tasks from Backups to Web Scraping in Just a Few Lines of Code (Rheinwerk Computing)

Scripting: Automation with Bash, PowerShell, and Python—Automate Everyday IT Tasks from Backups to Web Scraping in Just a Few Lines of Code (Rheinwerk Computing)

BUY & SAVE
$36.76
Scripting: Automation with Bash, PowerShell, and Python—Automate Everyday IT Tasks from Backups to Web Scraping in Just a Few Lines of Code (Rheinwerk Computing)
+
ONE MORE?

To create an empty array of arrays in PowerShell, you can use the following syntax:

$arrayOfArrays = @()

This will create an empty array that can hold other arrays. You can then add arrays to this main array as needed by using the += operator.

How to filter an array in PowerShell?

To filter an array in PowerShell, you can use the Where-Object cmdlet.

Here is an example of how to filter an array of numbers to only include values greater than 5:

$numbers = 1, 3, 6, 8, 10 $filteredNumbers = $numbers | Where-Object { $_ -gt 5 }

In this example, $filteredNumbers will contain the values 6, 8, and 10 from the original array $numbers.

You can adjust the filter criteria inside the script block {} to suit your specific requirements.

How to reverse an array in PowerShell?

Here's a simple example of how to reverse an array in PowerShell:

# Define an array $array = 1, 2, 3, 4, 5

Use the Reverse() method to reverse the array

[array]::Reverse($array)

Output the reversed array

$array

When you run this code, it will reverse the elements in the array so that the output will be [5, 4, 3, 2, 1].

How to merge arrays in PowerShell?

To merge arrays in PowerShell, you can use the "+" operator to combine two or more arrays into one. Here is an example:

$array1 = 1, 2, 3 $array2 = 4, 5, 6 $mergedArray = $array1 + $array2

Write-Output $mergedArray

This will output:

1 2 3 4 5 6

Alternatively, you can use the "AddRange()" method to merge arrays. Here is an example:

$array1 = 1, 2, 3 $array2 = 4, 5, 6

$array1.AddRange($array2)

Write-Output $array1

This will also output:

1 2 3 4 5 6