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>]
[-Site <String>] [-Site_Id <UInt64>] [-Role <String>] [-Role_Id <UInt64>] [-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.
```yaml 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.
```yaml 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.
```yaml 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').
```yaml 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.
```yaml 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).
```yaml 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.
```yaml 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
```yaml 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
```yaml 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
```yaml 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
```yaml 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.
```yaml Type: UInt64 Parameter Sets: Query Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Platform
String value of the platform
```yaml 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
```yaml Type: UInt64 Parameter Sets: Query Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Cluster_Group
String value of the cluster group.
```yaml 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.
```yaml Type: UInt64 Parameter Sets: Query Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Cluster_Type
String value of the Cluster type.
```yaml 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.
```yaml Type: UInt64 Parameter Sets: Query Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Cluster_Id
Database ID of the cluster.
```yaml Type: UInt64 Parameter Sets: Query Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Site
String value of the site.
```yaml 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.
```yaml Type: UInt64 Parameter Sets: Query Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Role
String value of the role.
```yaml 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.
```yaml Type: UInt64 Parameter Sets: Query Aliases:
Required: False Position: Named Default value: 0 Accept pipeline input: False Accept wildcard characters: False ```
-Limit
Number of results to return per page
```yaml 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
```yaml 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.
```yaml 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 }}
```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