PowerShell: Random Select

User avatar
hamid
Site Admin
Posts: 15
Joined: Mon Jun 17, 2019 2:19 pm
Contact:

PowerShell: Random Select

Postby hamid Mon Jul 08, 2019 10:30 am

Hello Club!

With PowerShell, when you're creating Variables with contents you can use Get-Random Command in order to choose randomly from contents you've created.

Example:

Create a Variable called $Variable test with numbers in it.

$VariableTest
= 1,2,3,4

Then call them randomly with the command below.

Get-Random $VariableTest
Microsoft MVP: Cloud and Datacenter Management
Info@hamidsadeghpour.net

Return to “PowerShell Learning”

Who is online

Users browsing this forum: No registered users and 0 guests