Share via


PowerShell remove value from Array List

Question

How to remove a value from an array?

Error

We tried removing it but ended up with an error:
Exception calling "Remove" with "1" argument(s): "Collection was of a fixed size."

Solution

001
002
003
004
005
[System.Collections.ArrayList]$array = @(1,2,3,4,5)

$array.Remove(2)

$array

Screen Shot