Thor Logo dbatools

Get-DbaRandomizedType

View Source
Sander Stad (@sqlstad, sqlstad.nl)
Windows, Linux, macOS

Synopsis

Lists available data types and subtypes for generating realistic test data during database masking operations

Description

Returns all available randomizer types and subtypes that can be used with Get-DbaRandomizedValue for data masking and test data generation. These types include realistic data patterns like Person names, Address components, Finance data, Internet values, and Random data types. This command helps you discover what fake data options are available when building data masking rules or generating test datasets for non-production environments.

Syntax

Get-DbaRandomizedType
    [[-RandomizedType] <String[]>]
    [[-RandomizedSubType] <String[]>]
    [[-Pattern] <String>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1

PS > Get-DbaRandomizedType
Get all the types and subtypes

Example: 2

PS > Get-DbaRandomizedType -Pattern “Addr”
Find all the types and sub types based on a pattern

Example: 3

PS > Get-DbaRandomizedType -RandomizedType Person
Find all the sub types for Person

Example: 4

PS > Get-DbaRandomizedType -RandomizedSubType LastName
Get all the types and subtypes that known by “LastName”

Optional Parameters

-RandomizedType

Filters results to specific main data categories for realistic test data generation.
Use this when you need to focus on particular data types like Person, Address, Finance, Internet, or Random data.
Available types include Address, Commerce, Company, Database, Date, Finance, Hacker, Image, Internet, Lorem, Name, Person, Phone, Random, System, and more.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default Value
-RandomizedSubType

Filters results to specific data subtypes within the main categories for precise data masking scenarios.
Use this when you need exact data patterns like FirstName, LastName, Email, CreditCardNumber, or ZipCode.
Subtypes provide granular control over the fake data generation for targeted column masking.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default Value
-Pattern

Searches both main types and subtypes using pattern matching to find relevant data generators.
Use this when you’re unsure of exact type names or want to discover related options like searching ‘Addr’ to find Address-related types.
Supports wildcard matching against both Type and SubType columns for flexible discovery.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default Value
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with “sea of red” exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this “nice by default” feature off and enables you to catch exceptions with your own try/catch.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default ValueFalse

Outputs

PSCustomObject

Returns one object per unique Type-SubType combination from the available randomizer types and subtypes.

Properties:

  • Type: The main data category for generating test data (e.g., Address, Commerce, Person, Finance, Internet)
  • SubType: The specific data pattern within the main category (e.g., FirstName, LastName, ZipCode, CreditCardNumber) Results are always sorted by Type and SubType, with duplicate combinations removed using -Unique. Filters specified by -RandomizedType, -RandomizedSubType, or -Pattern parameters only affect which combinations are returned, not the structure of the output objects.