Remove-NBVirtualMachine
Since
v1.0.4
SYNOPSIS
Deletes one or more virtual machines from Netbox.
SYNTAX
Single (Default)
Remove-NBVirtualMachine -Id <UInt64> [-Force] [-Raw] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
[<CommonParameters>]
Bulk
Remove-NBVirtualMachine -InputObject <PSObject> [-BatchSize <Int32>] [-Force] [-Raw]
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
Deletes virtual machines from Netbox Virtualization module. Supports both single VM deletion with the Id parameter and bulk deletion via pipeline input.
For bulk operations, use the -BatchSize parameter to control how many VMs are deleted per API request. Each object must have an Id property.
EXAMPLES
EXAMPLE 1
Remove-NBVirtualMachine -Id 123 -Force
Deletes VM with ID 123 without confirmation.
EXAMPLE 2
Get-NBVirtualMachine -Status "decommissioning" | Remove-NBVirtualMachine -Force
Bulk delete all VMs with decommissioning status.
EXAMPLE 3
$vmsToDelete = @(
[PSCustomObject]@{Id = 100}
[PSCustomObject]@{Id = 101}
[PSCustomObject]@{Id = 102}
)
$vmsToDelete | Remove-NBVirtualMachine -BatchSize 50 -Force
Bulk delete multiple VMs.
PARAMETERS
-Id
The database ID(s) of the virtual machine(s) to delete. Required for single mode.
```yaml Type: UInt64 Parameter Sets: Single Aliases:
Required: True Position: Named Default value: 0 Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ```
-InputObject
Pipeline input for bulk operations. Each object MUST have an Id property.
```yaml Type: PSObject Parameter Sets: Bulk Aliases:
Required: True Position: Named Default value: None Accept pipeline input: True (ByValue) Accept wildcard characters: False ```
-BatchSize
Number of VMs to delete per API request in bulk mode. Default: 50, Range: 1-1000
```yaml Type: Int32 Parameter Sets: Bulk Aliases:
Required: False Position: Named Default value: 100 Accept pipeline input: False Accept wildcard characters: False ```
-Force
Skip confirmation prompts.
```yaml Type: SwitchParameter Parameter Sets: (All) Aliases:
Required: False Position: Named Default value: False Accept pipeline input: False Accept wildcard characters: False ```
-Raw
{{ Fill Raw Description }}
```yaml Type: SwitchParameter Parameter Sets: (All) Aliases:
Required: False Position: Named Default value: False Accept pipeline input: False Accept wildcard characters: False ```
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
```yaml Type: SwitchParameter Parameter Sets: (All) Aliases: wi
Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```
-Confirm
Prompts you for confirmation before running the cmdlet.
```yaml Type: SwitchParameter Parameter Sets: (All) Aliases: cf
Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```
-ProgressAction
{{ Fill ProgressAction Description }}
```yaml Type: ActionPreference Parameter Sets: (All) Aliases: proga
Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
OUTPUTS
System.Void
NOTES
AddedInVersion: v1.0.4