Get-NBVirtualMachine
Since
v1.0.4
SYNOPSIS
Obtains virtual machines from NetBox.
SYNTAX
Query (Default)
Get-NBVirtualMachine [-All] [-PageSize <Int32>] [-Brief] [-Fields <String[]>] [-Omit <String[]>]
[-IncludeConfigContext] [-Query <String>] [-Name <String[]>] [-Status <String[]>] [-Tenant <String[]>]
[-Tenant_ID <UInt64[]>] [-Platform <String[]>] [-Platform_ID <UInt64[]>] [-Cluster_Group <String[]>]
[-Cluster_Group_Id <UInt64[]>] [-Cluster_Type <String[]>] [-Cluster_Type_Id <UInt64[]>]
[-Cluster_Id <UInt64[]>] [-Device <String[]>] [-Device_Id <UInt64[]>] [-Site <String[]>] [-Site_Id <UInt64[]>]
[-Role <String[]>] [-Role_Id <UInt64[]>] [-Virtual_Machine_Type <String[]>]
[-Virtual_Machine_Type_Id <UInt64[]>] [-Serial <String[]>] [-Limit <UInt16>] [-Offset <UInt16>] [-Raw]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
ByID
Get-NBVirtualMachine [-All] [-PageSize <Int32>] [-Brief] [-Fields <String[]>] [-Omit <String[]>]
[-IncludeConfigContext] [-Id <UInt64[]>] [-Limit <UInt16>] [-Offset <UInt16>] [-Raw]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
Obtains one or more virtual machines based on provided filters.
By default, config_context is excluded from the response for performance. Use -IncludeConfigContext to include it when needed.
EXAMPLES
EXAMPLE 1
Get-NBVirtualMachine
Returns VMs with config_context excluded by default.
EXAMPLE 2
Get-NBVirtualMachine -Brief
Returns minimal VM representations for dropdowns.
EXAMPLE 3
Get-NBVirtualMachine -IncludeConfigContext
Returns VMs with config_context included.
EXAMPLE 4
Get-NBVirtualMachine -Fields 'id','name','status','site.name'
Returns only the specified fields.
EXAMPLE 5
Get-NBVirtualMachine -Omit 'comments','description'
Returns VMs without comments and description fields (NetBox 4.5+).
PARAMETERS
-All
Automatically fetch all pages of results.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-PageSize
Number of items per page when using -All. Default: 100.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 100
Accept pipeline input: False
Accept wildcard characters: False
-Brief
Return a minimal representation of objects (id, url, display, name only). Reduces response size by ~90%. Ideal for dropdowns and reference lists.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Fields
Specify which fields to include in the response. Supports nested field selection (e.g., 'site.name', 'cluster.name').
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Omit
Specify which fields to exclude from the response. Requires NetBox 4.5.0 or later.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-IncludeConfigContext
Include config_context in the response. By default, config_context is excluded for performance (can be 10-100x faster without it).
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Query
Search query (maps to the 'q' API filter). Matches against VM name and primary IP address. Note: in NetBox 4.5.3+, this only matches the primary IP, not all assigned IPs.
Type: String
Parameter Sets: Query
Aliases: q
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Name
Name of the VM
Type: String[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Id
Database ID of the VM
Type: UInt64[]
Parameter Sets: ByID
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Status
Status of the VM
Type: String[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Tenant
String value of tenant
Type: String[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Tenant_ID
Database ID of the tenant.
Type: UInt64[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Platform
String value of the platform
Type: String[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Platform_ID
Database ID of the platform
Type: UInt64[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Cluster_Group
String value of the cluster group.
Type: String[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Cluster_Group_Id
Database ID of the cluster group.
Type: UInt64[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Cluster_Type
String value of the Cluster type.
Type: String[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Cluster_Type_Id
Database ID of the cluster type.
Type: UInt64[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Cluster_Id
Database ID of the cluster.
Type: UInt64[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Device
The string value of the device the VMs are attached to. (NetBox 4.6+).
Type: String[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Device_Id
The device Id of the device the VMs are attached to. (NetBox 4.6+).
Type: UInt64[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Site
String value of the site.
Type: String[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Site_Id
Database ID of the site.
Type: UInt64[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Role
String value of the role.
Type: String[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Role_Id
Database ID of the role.
Type: UInt64[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Virtual_Machine_Type
String value of the virtual machine type (Slug). (NetBox 4.6+)
Type: String[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Virtual_Machine_Type_Id
Database ID of the virtual machine type. (NetBox 4.6+)
Type: UInt64[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Serial
Serial number of the VM. You can query multiple serial numbers by separating them with commas (e.g., "12345","67890").
Type: String[]
Parameter Sets: Query
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Limit
Number of results to return per page
Type: UInt16
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
-Offset
The initial index from which to return the results
Type: UInt16
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
-Raw
Return the raw API response instead of extracting the results array.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
{{ Fill ProgressAction Description }}
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