Skip to content

Commit 1a5cb65

Browse files
committed
Cleaned up help and parameters
1 parent 0bfefd8 commit 1a5cb65

10 files changed

Lines changed: 92 additions & 44 deletions

functions/Initialize-PDCVhdDisk.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ function Initialize-PDCVhdDisk {
1515
1616
$scred = Get-Credential, then pass $scred object to the -Credential parameter.
1717
18+
.PARAMETER EnableException
19+
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
20+
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
21+
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
22+
23+
.PARAMETER WhatIf
24+
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.
25+
26+
.PARAMETER Confirm
27+
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
28+
1829
.NOTES
1930
Author: Sander Stad (@sqlstad, sqlstad.nl)
2031
@@ -46,7 +57,8 @@ function Initialize-PDCVhdDisk {
4657
$Credential,
4758
[ValidateSet('GPT', 'MBR')]
4859
[string]$PartitionStyle = 'GPT',
49-
[int]$AllocationUnitSize = 64KB
60+
[int]$AllocationUnitSize = 64KB,
61+
[switch]$EnableException
5062
)
5163

5264
begin {

functions/Invoke-PDCRepairClone.ps1

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ function Invoke-PDCRepairClone {
2121
Windows Authentication will be used if SqlCredential is not specified. SQL Server does not accept Windows credentials being passed as credentials.
2222
To connect as a different Windows user, run PowerShell as that user.
2323
24+
.PARAMETER EnableException
25+
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
26+
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
27+
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
28+
29+
.PARAMETER WhatIf
30+
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.
31+
32+
.PARAMETER Confirm
33+
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
34+
2435
.NOTES
2536
Author: Sander Stad (@sqlstad, sqlstad.nl)
2637
@@ -42,9 +53,9 @@ function Invoke-PDCRepairClone {
4253
param(
4354
[Parameter(Mandatory = $true)]
4455
[string[]]$HostName,
45-
4656
[System.Management.Automation.PSCredential]
47-
$SqlCredential
57+
$SqlCredential,
58+
[switch]$EnableException
4859
)
4960

5061
begin {
@@ -87,10 +98,10 @@ function Invoke-PDCRepairClone {
8798
# Get the clones registered for the host
8899
try {
89100
Write-PSFMessage -Message "Get the clones for host $hst" -Level Verbose
90-
$results = Invoke-DbaSqlQuery -SqlInstance $ecDatabaseServer -Database $ecDatabaseName -Query $query
101+
$results = Invoke-DbaSqlQuery -SqlInstance $pdcSqlInstance -Database $pdcDatabase -Query $query
91102
}
92103
catch {
93-
Stop-PSFFunction -Message "Couldn't get the clones for $hst" -Target $ecDatabaseServer -ErrorRecord $_ -Continue
104+
Stop-PSFFunction -Message "Couldn't get the clones for $hst" -Target $pdcSqlInstance -ErrorRecord $_ -Continue
94105
}
95106

96107
# Loop through the results

functions/New-PDCClone.ps1

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,30 +83,20 @@ function New-PDCClone {
8383
[parameter(Mandatory = $true)]
8484
[ValidateNotNullOrEmpty()]
8585
[object[]]$SqlInstance,
86-
8786
[System.Management.Automation.PSCredential]
8887
$SqlCredential,
89-
9088
[System.Management.Automation.PSCredential]
9189
$Credential,
92-
9390
[parameter(Mandatory = $true, ParameterSetName = "ByParent")]
9491
[string]$ParentVhd,
95-
9692
[string]$Destination,
97-
9893
[string]$CloneName,
99-
10094
[parameter(Mandatory = $true, ParameterSetName = "ByLatest")]
10195
[string[]]$Database,
102-
10396
[parameter(Mandatory = $true, ParameterSetName = "ByLatest")]
10497
[switch]$LatestImage,
105-
10698
[switch]$Disabled,
107-
10899
[switch]$Force,
109-
110100
[switch]$EnableException
111101
)
112102

functions/New-PDCImage.ps1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ function New-PDCImage {
5757
.PARAMETER Force
5858
Forcefully execute commands when needed
5959
60+
.PARAMETER EnableException
61+
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
62+
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
63+
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
64+
65+
.PARAMETER WhatIf
66+
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.
67+
68+
.PARAMETER Confirm
69+
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
70+
6071
.NOTES
6172
Author: Sander Stad (@sqlstad, sqlstad.nl)
6273
@@ -83,35 +94,24 @@ function New-PDCImage {
8394
[parameter(Mandatory = $true)]
8495
[ValidateNotNullOrEmpty()]
8596
[object]$SourceSqlInstance,
86-
8797
[System.Management.Automation.PSCredential]
8898
$SourceSqlCredential,
89-
9099
[Parameter(Mandatory = $true)]
91100
[ValidateNotNullOrEmpty()]
92101
[object]$DestinationSqlInstance,
93-
94102
[System.Management.Automation.PSCredential]
95103
$DestinationSqlCredential,
96-
97104
[System.Management.Automation.PSCredential]
98105
$DestinationCredential,
99-
100106
[Parameter(Mandatory = $true)]
101107
[ValidateNotNullOrEmpty()]
102108
[string]$ImageNetworkPath,
103-
104109
[string]$ImageLocalPath,
105-
106110
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
107111
[object[]]$Database,
108-
109112
[switch]$CreateFullBackup,
110-
111113
[switch]$UseLastFullBackup,
112-
113114
[switch]$Force,
114-
115115
[switch]$EnableException
116116
)
117117

functions/New-PDCVhdDisk.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ function New-PDCVhdDisk {
2828
.PARAMETER Force
2929
Forcefully create the neccesary items
3030
31+
.PARAMETER EnableException
32+
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
33+
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
34+
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
35+
36+
.PARAMETER WhatIf
37+
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.
38+
39+
.PARAMETER Confirm
40+
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
41+
3142
.NOTES
3243
Author: Sander Stad (@sqlstad, sqlstad.nl)
3344
@@ -55,7 +66,8 @@ function New-PDCVhdDisk {
5566
[uint64]$Size = 64TB,
5667
[switch]$FixedSize,
5768
[switch]$ReadOnly,
58-
[switch]$Force
69+
[switch]$Force,
70+
[switch]$EnableException
5971
)
6072

6173
begin {

functions/Remove-PDCClone.ps1

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ function Remove-PDCClone {
3434
.PARAMETER ExcludeDatabase
3535
Allows to filter to exclude specific databases
3636
37+
.PARAMETER EnableException
38+
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
39+
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
40+
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
41+
42+
.PARAMETER WhatIf
43+
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.
44+
45+
.PARAMETER Confirm
46+
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
47+
3748
.NOTES
3849
Author: Sander Stad (@sqlstad, sqlstad.nl)
3950
@@ -66,19 +77,14 @@ function Remove-PDCClone {
6677
[parameter(Mandatory = $true)]
6778
[ValidateNotNullOrEmpty()]
6879
[string[]]$HostName,
69-
7080
[System.Management.Automation.PSCredential]
7181
$SqlCredential,
72-
7382
[System.Management.Automation.PSCredential]
7483
$Credential,
75-
7684
[string[]]$Database,
77-
7885
[string[]]$ExcludeDatabase,
79-
80-
[switch]$All
81-
86+
[switch]$All,
87+
[switch]$EnableException
8288
)
8389

8490
begin {

functions/Remove-PDCImage.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@ function Remove-PDCImage {
3535
[parameter(Mandatory = $true)]
3636
[ValidateNotNullOrEmpty()]
3737
[string[]]$ImageLocation,
38-
3938
[System.Management.Automation.PSCredential]
4039
$Credential,
41-
42-
[switch]$Force
40+
[switch]$Force,
41+
[switch]$EnableException
4342
)
4443

4544
begin {

functions/Set-PDCConfiguration.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ function Set-PDCConfiguration {
2727
.PARAMETER Database
2828
Database to use to save all the information in
2929
30+
.PARAMETER EnableException
31+
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
32+
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
33+
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
34+
35+
.PARAMETER WhatIf
36+
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.
37+
38+
.PARAMETER Confirm
39+
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
3040
3141
.NOTES
3242
Author: Sander Stad (@sqlstad, sqlstad.nl)
@@ -49,11 +59,10 @@ function Set-PDCConfiguration {
4959
[ValidateNotNullOrEmpty()]
5060
[Alias("ServerInstance", "SqlServerSqlServer")]
5161
[object]$SqlInstance,
52-
5362
[System.Management.Automation.PSCredential]
5463
$SqlCredential,
55-
56-
[string]$Database
64+
[string]$Database,
65+
[switch]$EnableException
5766
)
5867

5968
begin {

internal/functions/Convert-PDCLocalUncPathToLocalPath.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ function Convert-PDCLocalUncPathToLocalPath {
1010
.PARAMETER UncPath
1111
UNC path to convert to local path
1212
13+
.PARAMETER EnableException
14+
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
15+
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
16+
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
17+
18+
.PARAMETER WhatIf
19+
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.
20+
21+
.PARAMETER Confirm
22+
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
23+
1324
.NOTES
1425
Author: Sander Stad (@sqlstad, sqlstad.nl)
1526
@@ -28,7 +39,8 @@ function Convert-PDCLocalUncPathToLocalPath {
2839
[CmdletBinding()]
2940
param(
3041
[Parameter(Mandatory = $true)]
31-
[string]$UncPath
42+
[string]$UncPath,
43+
[switch]$EnableException
3244
)
3345

3446
# Create the object

internal/functions/Test-PDCConfiguration.ps1

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,9 @@ function Test-PDCConfiguration {
4747

4848
param(
4949
[object]$SqlInstance,
50-
5150
[System.Management.Automation.PSCredential]
5251
$SqlCredential,
53-
5452
[string]$Database,
55-
5653
[switch]$EnableException
5754
)
5855

0 commit comments

Comments
 (0)