Set-NBVirtualMachine
Since
v1.0.4
SYNOPSIS
Updates one or more virtual machines in Netbox Virtualization module.
SYNTAX
Single (Default)
Set-NBVirtualMachine -Id <UInt64> [-Name <String>] [-Role <UInt64>] [-Cluster <UInt64>] [-Status <String>]
[-Platform <UInt64>] [-Primary_IP4 <UInt64>] [-Primary_IP6 <UInt64>] [-VCPUs <UInt16>] [-Memory <UInt64>]
[-Disk <UInt64>] [-Tenant <UInt64>] [-Comments <String>] [-Custom_Fields <Hashtable>]
[-Start_On_Boot <String>] [-Force] [-Tags <Object[]>] [-Raw] [-ProgressAction <ActionPreference>] [-WhatIf]
[-Confirm] [<CommonParameters>]
Bulk
Set-NBVirtualMachine -InputObject <PSObject> [-BatchSize <Int32>] [-Force] [-Tags <Object[]>] [-Raw]
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
Updates existing virtual machines in Netbox Virtualization module. Supports both single VM updates with individual parameters and bulk updates via pipeline input.
For bulk operations, use the -BatchSize parameter to control how many VMs are sent per API request. Each object must have an Id property.
EXAMPLES
EXAMPLE 1
Set-NBVirtualMachine -Id 123 -Status "active"
Updates VM 123 to active status.
EXAMPLE 2
Get-NBVirtualMachine -Status "offline" | ForEach-Object {
[PSCustomObject]@{Id = $_.id; Status = "active"}
} | Set-NBVirtualMachine -Force
Bulk update all offline VMs to active status.
EXAMPLE 3
$updates = @(
[PSCustomObject]@{Id = 100; Status = "active"; Comments = "Migrated"}
[PSCustomObject]@{Id = 101; Status = "active"; Comments = "Migrated"}
)
$updates | Set-NBVirtualMachine -BatchSize 50 -Force
Bulk update multiple VMs with different values.
PARAMETERS
-Id
The database ID of the virtual machine to update. Required for single updates.
```yaml Type: UInt64 Parameter Sets: Single Aliases:
Required: True Position: Named Default value: 0 Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ```
-Name
The new name for the VM.
```yaml Type: String Parameter Sets: Single Aliases:
Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```
-Role
The device role ID.
```yaml Type: UInt64 Parameter Sets: Single Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Cluster
The cluster ID.
```yaml Type: UInt64 Parameter Sets: Single Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Status
Status of the VM.
```yaml Type: String Parameter Sets: Single Aliases:
Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```
-Platform
The platform ID.
```yaml Type: UInt64 Parameter Sets: Single Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Primary_IP4
The primary IPv4 address ID.
```yaml Type: UInt64 Parameter Sets: Single Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Primary_IP6
The primary IPv6 address ID.
```yaml Type: UInt64 Parameter Sets: Single Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-VCPUs
Number of virtual CPUs.
```yaml Type: UInt16 Parameter Sets: Single Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Memory
Memory in MB.
```yaml Type: UInt64 Parameter Sets: Single Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Disk
Disk size in GB.
```yaml Type: UInt64 Parameter Sets: Single Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Tenant
The tenant ID.
```yaml Type: UInt64 Parameter Sets: Single Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Comments
Comments about the VM.
```yaml Type: String Parameter Sets: Single Aliases:
Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```
-Custom_Fields
Hashtable of custom field values.
```yaml Type: Hashtable Parameter Sets: Single Aliases:
Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```
-Start_On_Boot
Boot behavior for the VM (Netbox 4.5+ only). Values: 'on', 'off', 'laststate'
```yaml Type: String Parameter Sets: Single Aliases:
Required: False Position: Named Default value: None Accept pipeline input: False 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 update 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 ```
-Tags
{{ Fill Tags Description }}
```yaml Type: Object[] Parameter Sets: (All) Aliases:
Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```
-Raw
Return the raw API response instead of the results array.
```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.Management.Automation.PSObject
NOTES
AddedInVersion: v1.0.4