< Back

Invoke-DbaDbDataGenerator

Mon Jan 13, 2020 12:13 pm

NAME Invoke-DbaDbDataGenerator



SYNOPSIS

Invoke-DbaDbDataGenerator generates random data for tables





SYNTAX

Invoke-DbaDbDataGenerator [[-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]

[[-SqlCredential] <Pscredential>] [[-Database] <System.String[]>] [-FilePath] <System.Object> [[-Locale] <String>]

[[-CharacterString] <String>] [[-Table] <System.String[]>] [[-Column] <System.String[]>] [[-ExcludeTable]

<System.String[]>] [[-ExcludeColumn] <System.String[]>] [[-MaxValue] <Int>] [-ExactLength <Switch>]

[[-ModulusFactor] <Int>] [-EnableException <Switch>] [<CommonParameters>]





DESCRIPTION

Invoke-DbaDbDataMasking is able to generate random data for tables.





PARAMETERS

-CharacterString [<String>]

The characters to use in string data. 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' by

default



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Column [<System.String[]>]

Columns to process. By default all the columns will be processed



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Database [<System.String[]>]

Databases to process through



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-EnableException [<Switch>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ExactLength [<Switch>]

Mask string values to the same length. So 'Tate' will be replaced with 4 random characters.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ExcludeColumn [<System.String[]>]

Exclude specific columns even if it's listed in the config file.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ExcludeTable [<System.String[]>]

Exclude specific tables even if it's listed in the config file.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-FilePath [<System.Object>]

Configuration file that contains the which tables and columns need to be masked



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Locale [<String>]

Set the local to enable certain settings in the masking



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-MaxValue [<Int>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ModulusFactor [<Int>]

Calculating the next nullable by using the remainder from the modulus. Default is every 10.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SqlCredential [<Pscredential>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]

The target SQL Server instance or instances.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Table [<System.String[]>]

Tables to process. By default all the tables will be processed



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Tags: DataGeneration, Database

Author: Sander Stad (@sqlstad, sqlstad.nl)



Website: https://dbatools.io

Copyright: (c) 2018 by dbatools, licensed under MIT

License: MIT https://opensource.org/licenses/MIT



-------------------------- EXAMPLE 1 --------------------------



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.



RELATED LINKS

https://dbatools.io/Invoke-DbaDbDataGenerator