Open-BcpPackage

Opens the specified directory containing the VaultBCP xml files, for further operations.

Syntax

Open-BcpPackage [-Path] <DirectoryInfo> [[-Version] <BCPVersion>] [-IgnoreBomBlobs] [-Force] [<CommonParameters>]

Parameters

Type

Name

Description

Default value

Optional

DirectoryInfo

Path

Directory containing the VaultBCP xml files

no

BcpVersion

Version

The Vault version of the BCP package

BcpVersion._2024

yes

SwitchParameter

IgnoreBomBlobs

All the bomBlob*.xml files get ignored

False

yes

SwitchParameter

Force

Forces the reopening of a previously opened BCP package

False

yes

Return type

Bool: on success the cmdlet returns $true otherwise $false.
$result.Error ← On failure with an additional property ‘Error’ containing the Exception
$result.Location ← The directory in which the opened BCP package is located
$result.DatabaseLocation ← The location of the internal Database-file containing the whole BCP-package data

Remarks

The cmdlet opens the specified BCP package in the current AppDomain.
In order to allow ongoing operations to work correctly, it is important to specify the correct Version of the BCP package.

When opening a BCP package for the first time, the whole package get’s imported into an internal Database.
By doing this, the cmdlet reuses the existing Database file after BCP packages got opened once, for improving performance with large packages.

In order to bypass this optimization, the BCP package can be reopened by using the Force parameter.
Afterwards changes made to the original xml files will be reloaded into the internal Database.

The cmdlet supports opening multiple packages one after the other.
When the specified BCP package is already open, the opened package will be reused, as long as the Force parameter is not specified.

Note

In order to improve performance the IgnoreBomBlobs parameter can be used to skip the loading of all the bomBlob._.xml* files.
That means ongoing operations like e.g. Export-BcpPackage will ignore those files too, which could have an impact on the ongoing import into Vault!

Examples

In the following examples we are using our VaultBcp 2024 sample package for demonstration purposes:
Opening a BCP package

Open-BcpPackage -Path 'C:\Temp\bcp_samplepackage'

Opening a BCP package by settings its Version and by ignoring all the BomBlobs

'C:\Temp\bcp_samplepackage' | Open-BcpPackage -Version 2024 -IgnoreBomBlobs

Forcing the reopening of a BCP package and validating if it got opened correctly

$openPackageResult = Open-BcpPackage -Path 'C:\Temp\bcp_samplepackage' -Force
if(-not $openPackageResult ) {
	throw "Failed with error: " + $openPackageResult.Error.Message
}

Opening a BCP package by relative path and using the opening result

$openPackageResult = Open-BcpPackage -Path '.\Temp\bcp_samplepackage'

write-host "Opened package '$($openPackageResult.Location.Fullname)'..."
write-host "Version: '$([int]$openPackageResult.Version)'"
write-host "Internal database: '$($openPackageResult.DatabaseLocation.Name)'"