--- title: "Get-VBROracleCloudCompartment" description: "This cmdlet returns an array of compartments that belong to the tenancy of the specified Oracle Cloud Infrastructure account." canonical: "https://helpcenter.veeam.com/docs/vbr/powershell/get-vbroraclecloudcompartment.html" breadcrumb: "Veeam PowerShell Reference > Veeam PowerShell Reference > Data Recovery > Restore to Oracle Cloud Infrastructure > Recovery > Get-VBROracleCloudCompartment" dateModified: "2026-11-09" --- # Get-VBROracleCloudCompartment ## Short Description Returns compartments in Oracle Cloud Infrastructure. **Product Edition**: Standard, Enterprise, Enterprise Plus, Veeam Universal License ## Syntax ``` Get-VBROracleCloudCompartment -Account [-Name ] [-AccessibleOnly] [] ``` ## Detailed Description This cmdlet returns an array of compartments that belong to the tenancy of the specified Oracle Cloud Infrastructure account. ## Parameters

Parameter

Description

Type

Required

Position

Accept Pipeline Input

AccessibleOnly

Defines that the cmdlet will return only compartments that the OCI account can access.

If you do not provide this parameter, the cmdlet will return all compartments of the tenancy.

SwitchParameter

False

Named

False

Account

Specifies the OCI account. The cmdlet will return compartments of the tenancy that this account belongs to.

Accepts the VBROracleCloudAccount object. To get this object, run the Get-VBROracleCloudAccount cmdlet.

VBROracleCloudAccount

True

Named

True (ByPropertyName, ByValue)

Name

Specifies an array of names of compartments. The cmdlet will return compartments with these names.

You can use wildcard characters in the names.

String[]

False

Named

False

`` This cmdlet supports Microsoft PowerShell common parameters. For more information on common parameters, see [ Microsoft Docs](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_commonparameters?view=powershell-7). ## Output Object The cmdlet returns the [`VBROracleCloudCompartment`](vbroraclecloudcompartment.md) object that contains the compartment settings. ## Examples ::: example ### Example 1. Getting All Compartments This example shows how to get all compartments of the Oracle Cloud Infrastructure account. ``` $account = Get-VBROracleCloudAccount -Name "My OCI Account" Get-VBROracleCloudCompartment -Account $account ``` Perform the following steps: 1. Run the [`Get-VBROracleCloudAccount`](get-vbroraclecloudaccount.md) cmdlet. Specify the `Name` parameter value. Save the result to the `$account` variable. 2. Run the `Get-VBROracleCloudCompartment` cmdlet. Set the `$account` variable as the `Account` parameter value. ::: ::: example ### Example 2. Getting Accessible Compartment by Name This example shows how to get a compartment by its name. The cmdlet will return the compartment only if the account has access to it. ``` $account = Get-VBROracleCloudAccount -Name "My OCI Account" $compartment = Get-VBROracleCloudCompartment -Account $account -Name "Restore" -AccessibleOnly ``` Perform the following steps: 1. Run the [`Get-VBROracleCloudAccount`](get-vbroraclecloudaccount.md) cmdlet. Specify the `Name` parameter value. Save the result to the `$account` variable. 2. Run the `Get-VBROracleCloudCompartment` cmdlet. Specify the following settings: - Set the `$account` variable as the `Account` parameter value. - Specify the `Name` parameter value. - Provide the `AccessibleOnly` parameter. Save the result to the `$compartment` variable to use it when you run the [`Start-VBRVMRestoreToOracleCloud`](start-vbrvmrestoretooraclecloud.md) cmdlet. :::