Arrays S
PowerShell

Arrays are very usefull to store information in it.
Let's say you want only the mac-address of the output of ipconfig
You could store the information in the arrays and then pull out the information one by one

Okay let's get started

$result=(ipconfig /all)
$result[46]
Physical Address. . . . . . . . . : 00-00-00-00-00-00

To count the array type
$result.count
72

In my case there were 72 items in the array and some are just blank lines.

To reverse an array let's say the output of ipconfig /all do as follows:

$a=(ipconfig /all)
[array]::reverse($a)
$a

If you want to fill a textfile with 100 random numbers you would something like this:
1..100 | Foreach-Object {$_ * (get-random) } > random.txt

On Me
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License