mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-16 03:05:47 +00:00
Site(DCIM): Add Remove-NetboxDCIMSite for Remove DCIM Site
This commit is contained in:
parent
1e6bd6b011
commit
c5fcb6e970
1 changed files with 64 additions and 0 deletions
64
Functions/DCIM/Sites/Remove-NetboxDCIMSite.ps1
Normal file
64
Functions/DCIM/Sites/Remove-NetboxDCIMSite.ps1
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
<#
|
||||||
|
.NOTES
|
||||||
|
===========================================================================
|
||||||
|
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181
|
||||||
|
Created on: 2020-10-02 15:52
|
||||||
|
Created by: Claussen
|
||||||
|
Organization: NEOnet
|
||||||
|
Filename: New-NetboxDCIMSite.ps1
|
||||||
|
===========================================================================
|
||||||
|
.DESCRIPTION
|
||||||
|
A description of the file.
|
||||||
|
#>
|
||||||
|
|
||||||
|
|
||||||
|
function Remove-NetboxDCIMSite {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Remove a Site
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Remove a DCIM Site from Netbox
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Remove-NetboxDCIMSite -Id 1
|
||||||
|
|
||||||
|
Remove DCM Site with id 1
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Get-NetboxDCIMSite -name My Site | Remove-NetboxDCIMSite -confirm:$false
|
||||||
|
|
||||||
|
Remove DCM Site with name My Site without confirmation
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
[CmdletBinding(ConfirmImpact = 'High',
|
||||||
|
SupportsShouldProcess = $true)]
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(Mandatory = $true,
|
||||||
|
ValueFromPipelineByPropertyName = $true)]
|
||||||
|
[uint]$Id
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
$CurrentSite = Get-NetboxDCIMSite -Id $Id -ErrorAction Stop
|
||||||
|
|
||||||
|
if ($pscmdlet.ShouldProcess("$($CurrentSite.Name)/$($CurrentSite.Id)", "Remove Site")) {
|
||||||
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'sites', $CurrentSite.Id))
|
||||||
|
|
||||||
|
$URI = BuildNewURI -Segments $Segments
|
||||||
|
|
||||||
|
InvokeNetboxRequest -URI $URI -Method DELETE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue