About 3,930,000 results
Open links in new tab
  1. How to Remove Item From an Array in PowerShell - Delft Stack

    Feb 12, 2024 · The RemoveAt() method in PowerShell is used to remove an element from an array at a specific index position. This method modifies the original array by removing the element at the specified index and shifting all subsequent elements to the left to fill the gap.

  2. PowerShell Remove Item From Array: A Quick Guide

    In PowerShell, you can remove an item from an array by using the `Where-Object` cmdlet to filter out the unwanted element. Here's a code snippet demonstrating how to remove the number 3 from an array:

  3. How to Remove Items from an Array in PowerShell?

    Jan 25, 2024 · To remove items from an array in PowerShell, create a new array without the item you want to remove or by using an ArrayList to which you can directly apply the Remove method. For example, to remove an item at index 0 from an array, you can use $array = $array[1..$array.length] to skip the first item.

  4. PowerShell Remove item [0] from an array - Stack Overflow

    To remove the first entry in the array, you could overwrite the array by a copy that includes every item except the first, like this: $arr = 1..5 $arr 1 2 3 4 5 $arr = $arr[1..($arr.Length-1)] $arr 2 3 4 5

  5. How to remove item from an array in PowerShell?

    Feb 22, 2016 · I'm using Powershell 1.0 to remove an item from an Array. Here's my script: [string]$backupDir = $(throw "Please supply the directory to housekeep"), . [int]$maxAge = 30, [switch]$NoRecurse, [switch]$KeepDirectories.

  6. How to Remove an Item From a PowerShell Array - ITPro Today

    The easiest way to remove an item from a PowerShell array is by setting the item's index position to $Null. The approach makes PowerShell treat that position as if it no longer contains a value. Here's how it works: First, create an array containing the letters A through F. You can do this by entering this command: $A=@('A', 'B', 'C', 'D', 'E ...

  7. PowerShell - Removing Items from Array - Stack Overflow

    Oct 2, 2021 · I'm trying to remove items from an array that match special keywords. My array looks something like this: $Printers =@('Printer Phone', 'Printer Building1', 'Printer XML', 'Printer Station', ...)

  8. Removing Objects from Arrays in PowerShell - SAPIEN Blog

    Nov 18, 2014 · One way to remove an object from a fixed-size array is to create a new array that includes only selected objects from the original array. In this command, we use a ForEach loop go through every letter in the $letters array.

  9. How to Remove an Item from an Array in PowerShell?

    Aug 6, 2022 · You’ll learn how to remove items from arrays and create new arrays using ArrayList and built-in PowerShell cmdlets. We’ll cover removing items by index, clearing entire arrays, and special cases like removing matching items or empty elements.

  10. PowerShell Cookbook - Remove Elements from an Array

    You want to remove all elements from an array that match a given item or term—either exactly, by pattern, or by regular expression. Solution To remove all elements from an array that match a pattern, use the -ne , -notlike , and -notmatch comparison operators, as shown in Example 7-2.

  11. Some results have been removed
Refresh