Contact Info

Crumbtrail » Administration » Powershell » Powershell 2.0 » Get-Random

Get-Random - Powershell 2.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Short description
Gets a random number, or selects objects randomly from a collection.

Get-Random [-InputObject] <Object[]> [-Count <int>] [-SetSeed <int>] [<CommonParameters>]

Get-Random [[-Maximum] <Object>] [-Minimum <Object>] [-SetSeed <int>] [<CommonParameters>]

The Get-Random cmdlet gets a randomly selected number. If you submit a collection of objects to Get-Random, it gets
 one or more randomly selected objects from the collection. 

Without parameters or input, a Get-Random command returns a randomly selected 32-bit unsigned integer between 0 (ze
ro) and Int32.MaxValue (0x7FFFFFFF, 2,147,483,647).

You can use the parameters of Get-Random to specify a seed number, minimum and maximum values, and the number of ob
jects returned from a submitted collection.