-
Notifications
You must be signed in to change notification settings - Fork 14
/
Remove-Deployment.ps1
39 lines (36 loc) · 2.48 KB
/
Remove-Deployment.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function Remove-Deployment
{
<#
.Synopsis
Removes a Pipeworks deployment
.Description
Removes a Pipeworks deployment from the list of deployments
.Example
Remove-Deployment -Name EZOut # Removes EZOut from the list of deployed modules
.Link
Get-Deployment
.Link
Add-Deployment
#>
[CmdletBinding(ConfirmImpact='High')]
[OutputType([Nullable])]
param(
# The name of the module to remove from the deployment
[Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
[string]
$Name
)
process {
# Confirm they really want to remove it
if ($PSCmdlet.ShouldProcess("Remove $Name")) {
#region Extract the existing deployments, remove, and resave
$existingDeployments = Get-SecureSetting -Name "PipeworksDeployments" -ValueOnly
if (-not $existingDeployments) {
$existingDeployments = @{}
}
$existingDeployments.Remove($name)
Add-SecureSetting -Name PipeworksDeployments -Hashtable $existingDeployments
#endregion Extract the existing deployments, remove, and resave
}
}
}