|
1 | 1 | function New-PSDCClone { |
2 | 2 | <# |
3 | | -.SYNOPSIS |
4 | | - New-PSDCClone creates a new clone |
| 3 | + .SYNOPSIS |
| 4 | + New-PSDCClone creates a new clone |
5 | 5 |
|
6 | | -.DESCRIPTION |
7 | | - New-PSDCClone willcreate a new clone based on an image. |
8 | | - The clone will be created in a certain directory, mounted and attached to a database server. |
| 6 | + .DESCRIPTION |
| 7 | + New-PSDCClone willcreate a new clone based on an image. |
| 8 | + The clone will be created in a certain directory, mounted and attached to a database server. |
9 | 9 |
|
10 | | -.PARAMETER SqlInstance |
11 | | - SQL Server name or SMO object representing the SQL Server to connect to |
| 10 | + .PARAMETER SqlInstance |
| 11 | + SQL Server name or SMO object representing the SQL Server to connect to |
12 | 12 |
|
13 | | -.PARAMETER SqlCredential |
14 | | - Allows you to login to servers using SQL Logins as opposed to Windows Auth/Integrated/Trusted. To use: |
| 13 | + .PARAMETER SqlCredential |
| 14 | + Allows you to login to servers using SQL Logins as opposed to Windows Auth/Integrated/Trusted. To use: |
15 | 15 |
|
16 | | - $scred = Get-Credential, then pass $scred object to the -SqlCredential parameter. |
| 16 | + $scred = Get-Credential, then pass $scred object to the -SqlCredential parameter. |
17 | 17 |
|
18 | | - Windows Authentication will be used if SqlCredential is not specified. SQL Server does not accept Windows credentials being passed as credentials. |
19 | | - To connect as a different Windows user, run PowerShell as that user. |
| 18 | + Windows Authentication will be used if SqlCredential is not specified. SQL Server does not accept Windows credentials being passed as credentials. |
| 19 | + To connect as a different Windows user, run PowerShell as that user. |
20 | 20 |
|
21 | | -.PARAMETER Credential |
22 | | - Allows you to login to servers using Windows Auth/Integrated/Trusted. To use: |
| 21 | + .PARAMETER Credential |
| 22 | + Allows you to login to servers using Windows Auth/Integrated/Trusted. To use: |
23 | 23 |
|
24 | | - $scred = Get-Credential, then pass $scred object to the -Credential parameter. |
| 24 | + $scred = Get-Credential, then pass $scred object to the -Credential parameter. |
25 | 25 |
|
26 | | -.PARAMETER ParentVhd |
27 | | - Points to the parent VHD to create the clone from |
| 26 | + .PARAMETER ParentVhd |
| 27 | + Points to the parent VHD to create the clone from |
28 | 28 |
|
29 | | -.PARAMETER Destination |
30 | | - Destination directory to save the clone to |
| 29 | + .PARAMETER Destination |
| 30 | + Destination directory to save the clone to |
31 | 31 |
|
32 | | -.PARAMETER CloneName |
33 | | - Name of the clone |
| 32 | + .PARAMETER CloneName |
| 33 | + Name of the clone |
34 | 34 |
|
35 | | -.PARAMETER Database |
36 | | - Database name for the clone |
| 35 | + .PARAMETER Database |
| 36 | + Database name for the clone |
37 | 37 |
|
38 | | -.PARAMETER LatestImage |
39 | | - Automatically get the last image ever created for an specific database |
| 38 | + .PARAMETER LatestImage |
| 39 | + Automatically get the last image ever created for an specific database |
40 | 40 |
|
41 | | -.PARAMETER Disabled |
42 | | - Registers the clone in the configuration as disabled. |
43 | | - If this setting is used the clone will not be recovered when the repair command is run |
| 41 | + .PARAMETER Disabled |
| 42 | + Registers the clone in the configuration as disabled. |
| 43 | + If this setting is used the clone will not be recovered when the repair command is run |
44 | 44 |
|
45 | | -.PARAMETER Force |
46 | | - Forcefully create items when needed |
| 45 | + .PARAMETER Force |
| 46 | + Forcefully create items when needed |
47 | 47 |
|
48 | | -.PARAMETER EnableException |
49 | | - By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. |
50 | | - This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting. |
51 | | - Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch. |
| 48 | + .PARAMETER EnableException |
| 49 | + By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. |
| 50 | + This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting. |
| 51 | + Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch. |
52 | 52 |
|
53 | | -.PARAMETER WhatIf |
54 | | - 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. |
| 53 | + .PARAMETER WhatIf |
| 54 | + 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. |
55 | 55 |
|
56 | | -.PARAMETER Confirm |
57 | | - If this switch is enabled, you will be prompted for confirmation before executing any operations that change state. |
| 56 | + .PARAMETER Confirm |
| 57 | + If this switch is enabled, you will be prompted for confirmation before executing any operations that change state. |
58 | 58 |
|
59 | | -.NOTES |
60 | | - Author: Sander Stad (@sqlstad, sqlstad.nl) |
| 59 | + .NOTES |
| 60 | + Author: Sander Stad (@sqlstad, sqlstad.nl) |
61 | 61 |
|
62 | | - Website: https://psdatabaseclone.io |
63 | | - Copyright: (C) Sander Stad, sander@sqlstad.nl |
64 | | - License: MIT https://opensource.org/licenses/MIT |
| 62 | + Website: https://psdatabaseclone.io |
| 63 | + Copyright: (C) Sander Stad, sander@sqlstad.nl |
| 64 | + License: MIT https://opensource.org/licenses/MIT |
65 | 65 |
|
66 | | -.LINK |
67 | | - https://psdatabaseclone.io/ |
| 66 | + .LINK |
| 67 | + https://psdatabaseclone.io/ |
68 | 68 |
|
69 | | -.EXAMPLE |
70 | | - New-PSDCClone -SqlInstance SQLDB1 -ParentVhd C:\Temp\images\DB1_20180623203204.vhdx -Destination C:\Temp\clones\ -CloneName DB1_Clone1 |
| 69 | + .EXAMPLE |
| 70 | + New-PSDCClone -SqlInstance SQLDB1 -ParentVhd C:\Temp\images\DB1_20180623203204.vhdx -Destination C:\Temp\clones\ -CloneName DB1_Clone1 |
71 | 71 |
|
72 | | - Create a new clone based on the image DB1_20180623203204.vhdx and attach the database to SQLDB1 as DB1_Clone1 |
| 72 | + Create a new clone based on the image DB1_20180623203204.vhdx and attach the database to SQLDB1 as DB1_Clone1 |
73 | 73 |
|
74 | | -.EXAMPLE |
75 | | - New-PSDCClone -SqlInstance SQLDB1 -Database DB1, DB2 -LatestImage |
| 74 | + .EXAMPLE |
| 75 | + New-PSDCClone -SqlInstance SQLDB1 -Database DB1, DB2 -LatestImage |
76 | 76 |
|
77 | | - Create a new clone on SQLDB1 for the databases DB1 and DB2 with the latest image for those databases |
| 77 | + Create a new clone on SQLDB1 for the databases DB1 and DB2 with the latest image for those databases |
78 | 78 |
|
79 | | -.EXAMPLE |
80 | | - New-PSDCClone -SqlInstance SQLDB1, SQLDB2 -Database DB1 -LatestImage |
| 79 | + .EXAMPLE |
| 80 | + New-PSDCClone -SqlInstance SQLDB1, SQLDB2 -Database DB1 -LatestImage |
81 | 81 |
|
82 | | - Create a new clone on SQLDB1 and SQLDB2 for the databases DB1 with the latest image |
83 | | -#> |
| 82 | + Create a new clone on SQLDB1 and SQLDB2 for the databases DB1 with the latest image |
| 83 | + #> |
84 | 84 | [CmdLetBinding(DefaultParameterSetName = 'ByLatest', SupportsShouldProcess = $true)] |
85 | 85 | param( |
86 | 86 | [parameter(Mandatory = $true)] |
|
0 commit comments