mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-15 02:35:46 +00:00
Added Remove-NetboxDCIMRearPort function
This commit is contained in:
parent
813f5b7bdc
commit
b8392dc49c
1 changed files with 42 additions and 0 deletions
42
Functions/DCIM/RearPorts/Remove-NetboxDCIMRearPort.ps1
Normal file
42
Functions/DCIM/RearPorts/Remove-NetboxDCIMRearPort.ps1
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
function Remove-NetboxDCIMRearPort
|
||||
{
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'High',
|
||||
SupportsShouldProcess = $true)]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint16[]]$Id,
|
||||
|
||||
[switch]$Force
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
foreach ($RearPortID in $Id)
|
||||
{
|
||||
$CurrentPort = Get-NetboxDCIMRearPort -Id $RearPortID -ErrorAction Stop
|
||||
|
||||
if ($Force -or $pscmdlet.ShouldProcess("Name: $($CurrentPort.Name) | ID: $($CurrentPort.Id)", "Remove"))
|
||||
{
|
||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'rear-ports', $CurrentPort.Id))
|
||||
|
||||
$URI = BuildNewURI -Segments $Segments
|
||||
|
||||
InvokeNetboxRequest -URI $URI -Method DELETE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue