PowerShell Array
- 07 February
PowerShell – Remove Item from Array
Please note that we will use ArrayList instead of Array here as Array is fixed size and it can not be altered. Using Remove() Method Use the Remove() method to eliminate an item from an ArrayList in PowerShell. [crayon-6728b03f9ec15763836750/] [crayon-6728b03f9ec21234868741/] In the above example, the courses titled Maths, Chemistry, and Physics are added to an […]
- 26 December
Remove Duplicates from Array in PowerShell
Using Select-Object with the -Unique Parameter To remove duplicates from array in PowerShell: Use the array operator to create an array having duplicate values. Use the Select-Object with the -Unique parameter to select unique values from the array we created in the previous step. [crayon-6728b03fa0cab251384436/] [crayon-6728b03fa0cb3601044505/] For this code, we used the array operator (@()) […]
- 16 December
Write Array to CSV in PowerShell
This article will explain how to write an array to a CSV file in PowerShell. Using the Export-Csv cmdlet The Export-Csv cmdlet in PowerShell creates a CSV file of the given objects. But you cannot directly write an array to a CSV file correctly. When you pipe the array to Export-Csv, the result will be […]