Tip: In my FAQ Spanish I have been asked how to retrieve a random name from a text file which contains names separated by comma.
There are several ways to do that, but I prefer to take advantage of the -InputObject parameter instead of piping to Get-Random.
1 |
Get-Random -InputObject $((Get-Content -Path ‘C:\nombres.txt’) -split ‘,’) |