Skip to content

Commit fb54cf9

Browse files
committed
Added shoudsupportprocess, removed validation from hostname parameter
1 parent ddc48b6 commit fb54cf9

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

functions/Remove-PDCClone.ps1

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ function Remove-PDCClone {
7171
Removes all clones from Host1
7272
7373
#>
74-
[CmdLetBinding(, DefaultParameterSetName = "HostName")]
74+
[CmdLetBinding(DefaultParameterSetName = "HostName", SupportsShouldProcess = $true,
75+
ConfirmImpact = 'High')]
7576

7677
param(
77-
[parameter(Mandatory = $true, ParameterSetName = "HostName")]
78-
[ValidateNotNullOrEmpty()]
78+
[parameter(ParameterSetName = "HostName")]
7979
[string[]]$HostName,
8080
[System.Management.Automation.PSCredential]
8181
$SqlCredential,
@@ -102,6 +102,14 @@ function Remove-PDCClone {
102102
$pdcSqlInstance = Get-PSFConfigValue -FullName psdatabaseclone.database.server
103103
$pdcDatabase = Get-PSFConfigValue -FullName psdatabaseclone.database.name
104104

105+
if (-not $HostName -and -not $InputObject) {
106+
107+
if(-not $PSCmdlet.ShouldProcess("All hosts" , "Delete all clones on all hosts?`nIf not please say no and use -HostName and/or -Database")){
108+
return
109+
}
110+
111+
}
112+
105113
Write-PSFMessage -Message "Started removing database clones" -Level Verbose
106114

107115
# Get all the items

0 commit comments

Comments
 (0)