New-SqlCloneTemplate
Published 01 May 2018
New-SqlCloneTemplate
Creates a new clone templates for an image.
Syntax
New-SqlCloneTemplate [-Image] <ImageResource> [-Name] <string> -Modifications <ModificationScript[]> [<CommonParameters>]
Description
The New-SqlCloneTemplate cmdlet creates a template for an image which can be run while creating a new clone from that image.
This cmdlet returns a CloneTemplateResource which can be passed to the New-SqlClone cmdlet.
Connect-SqlClone must be called before this cmdlet.
Parameters
-Image
<RedGate.SqlClone.Client.Api.Objects.ImageResource>
Specifies the parent image that will have the clone template. The Get-SqlCloneImage cmdlet can be used to get an ImageResource.
Aliases | None |
Required? | true |
Position? | 0 |
Default Value | None |
Accept Pipeline Input | true (ByValue) |
Accept Wildcard Characters | false |
-Name
<System.String>
Specifies name of the template
Aliases | None |
Required? | true |
Position? | 1 |
Default Value | None |
Accept Pipeline Input | false |
Accept Wildcard Characters | false |
-Modifications
<RedGate.SqlClone.Api.ScriptRunning.ModificationScript[]>
Specifies an ordered sequence of modifications to make to the clone database while it is being created. SQL script modifications will run with limited privileges, as a temporary user & login that has db_owner on the image database, and VIEW SERVER STATE and VIEW ANY DEFINITION on the server.
See New-SqlCloneSqlScript.
Aliases | None |
Required? | true |
Position? | named |
Default Value | None |
Accept Pipeline Input | false |
Accept Wildcard Characters | false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see http://technet.microsoft.com/en-us/library/hh847884.aspx.
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
-
RedGate.SqlClone.Client.Api.Objects.ImageResource
Specifies the parent image that will have the clone template. The Get-SqlCloneImage cmdlet can be used to get an ImageResource.
Return values
The output type is the type of the objects that the cmdlet emits.
- System.String
Examples
---------- EXAMPLE 1 ----------
Connect-SqlClone -ServerUrl 'http://sql-clone.example.com:14145' $Image = Get-SqlCloneImage -Name 'AdventureWorks-20170106110745' New-SqlCloneTemplate -Name 'MyCloneTemplate' -Image $Image -Modifications ((New-SqlCloneSqlScript -Path '\\red-gate\data-scripts\change-permissions.sql'), (New-SqlCloneSqlScript -Sql 'some sql script'))
This example creates a new clone template named 'MyCloneTemplate' for the image named 'AdventureWorks-20170106110745'.