Author | Sander Stad (@sqlstad, sqlstad.nl) |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Invoke-DbaDbDataGenerator on GitHub.
Want to see the Bill Of Health for this command? Check out Invoke-DbaDbDataGenerator.
Invoke-DbaDbDataGenerator generates random data for tables
Invoke-DbaDbDataMasking is able to generate random data for tables.
Invoke-DbaDbDataGenerator
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[[-Database] <String[]>]
[-FilePath] <Object>
[[-Locale] <String>]
[[-CharacterString] <String>]
[[-Table] <String[]>]
[[-Column] <String[]>]
[[-ExcludeTable] <String[]>]
[[-ExcludeColumn] <String[]>]
[[-MaxValue] <Int32>]
[-ExactLength]
[[-ModulusFactor] <Int32>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Invoke-DbaDbDataGenerator -SqlInstance sqldb2 -Database DB1 -FilePath C:\temp\sqldb1.db1.tables.json
Apply the data generation configuration from the file "sqldb1.db1.tables.json" to the db1 database on sqldb2. Prompt for confirmation for each table.
Configuration file that contains the which tables and columns need to be masked
Alias | Path,FullName |
Required | True |
Pipeline | true (ByValue) |
Default Value |
The target SQL Server instance or instances.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Databases to process through
Alias | |
Required | False |
Pipeline | false |
Default Value |
Set the local to enable certain settings in the masking
Alias | |
Required | False |
Pipeline | false |
Default Value | en |
The characters to use in string data. 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' by default
Alias | |
Required | False |
Pipeline | false |
Default Value | abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 |
Tables to process. By default all the tables will be processed
Alias | |
Required | False |
Pipeline | false |
Default Value |
Columns to process. By default all the columns will be processed
Alias | |
Required | False |
Pipeline | false |
Default Value |
Exclude specific tables even if it's listed in the config file.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Exclude specific columns even if it's listed in the config file.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Force a max length of strings instead of relying on datatype maxes. Note if a string datatype has a lower MaxValue, that will be used instead.
Useful for adhoc updates and testing, otherwise, the config file should be used.
Alias | |
Required | False |
Pipeline | false |
Default Value | 0 |
Mask string values to the same length. So 'Tate' will be replaced with 4 random characters.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Calculating the next nullable by using the remainder from the modulus. Default is every 10.
Alias | |
Required | False |
Pipeline | false |
Default Value | 10 |
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.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |