Quantcast
Channel: Scripting Blog
Viewing all articles
Browse latest Browse all 2129

PowerTip: Use PowerShell to pick a random name from a list

$
0
0

Summary: Using the Get-Random Cmdlet to select a random list of names instead of numbers

Hey! Dr. Scripto!

I’d like to pick a random name from a list to generate user names in my lab.   Could you show me an example?

I’d be delighted to.   Just use an array of names and then add them as a parameter to Get-Random.   You could even pipe it to Get-Random if you liked as well.

$NameList='John','Charlotte','Sean','Colleen','Namoli','Maura','Neula'

Get-Random -InputObject $NameList

Drawing of Dr. Scripto

Windows PowerShell, Sean Kearney, Scripting Guy, PowerTip


Viewing all articles
Browse latest Browse all 2129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>