How do I run 2 masking sets in powershell sql clone

$MachineName = 'mymachine' 
$ImageLocation = '\\mymachine\Images' 
$DatabaseName = 'dbname' 
$ScriptPath = 'C:\Database\CloneSQL\db.sql' 
$MaskingSetPath1 = 'C:\Database\DataMaskerSet\Clone-NoXML.DMSMaskSet'
$MaskingSetPath2 = 'C:\Database\DataMaskerSet\Clone-XML.DMSMaskSet' 
$BackupFileName0 = '\\mybackupserver\backup.bak'


Connect-SqlClone -ServerUrl $ServerUrl
$SqlServerInstance = Get-SqlCloneSqlServerInstance -MachineName $MachineName
$ImageDestination = Get-SqlCloneImageLocation -Path $ImageLocation

$MaskingSet1 = New-SqlCloneMask -Path $MaskingSetPath1
$MaskingSet2 = New-SqlCloneMask -Path $MaskingSetPath2
$SQLScript = New-SqlCloneSqlScript -Path $ScriptPath

$ImageOperation = New-SqlCloneImage -Name "$DatabaseName-$(Get-Date -Format yyyyMMdd)" `
    -SqlServerInstance $SqlServerInstance `
    -BackupFileName @($BackupFileName0) `
    -Destination $ImageDestination `
    -Modifications @($MaskingSet1, $SQLScript) 

Wait-SqlCloneOperation -Operation $ImageOperation


THIS WORKS Above, but when i add the 2nd set it fails (below)

$MachineName = 'mymachine' 
$ImageLocation = '\\mymachine\Images' 
$DatabaseName = 'dbname' 
$ScriptPath = 'C:\Database\CloneSQL\db.sql' 
$MaskingSetPath1 = 'C:\Database\DataMaskerSet\Clone-NoXML.DMSMaskSet'
$MaskingSetPath2 = 'C:\Database\DataMaskerSet\Clone-XML.DMSMaskSet' 
$BackupFileName0 = '\\mybackupserver\backup.bak'


Connect-SqlClone -ServerUrl $ServerUrl
$SqlServerInstance = Get-SqlCloneSqlServerInstance -MachineName $MachineName
$ImageDestination = Get-SqlCloneImageLocation -Path $ImageLocation

$MaskingSet1 = New-SqlCloneMask -Path $MaskingSetPath1
$MaskingSet2 = New-SqlCloneMask -Path $MaskingSetPath2
$SQLScript = New-SqlCloneSqlScript -Path $ScriptPath

$ImageOperation = New-SqlCloneImage -Name "$DatabaseName-$(Get-Date -Format yyyyMMdd)" `
    -SqlServerInstance $SqlServerInstance `
    -BackupFileName @($BackupFileName0) `
    -Destination $ImageDestination `
    -Modifications @($MaskingSet1,$MaskingSet2, $SQLScript) 

Wait-SqlCloneOperation -Operation $ImageOperation
Tagged:

Answers

Sign In or Register to comment.