Export-BcpPackage

Exports the opened BCP package to the specified directory.

Syntax

Export-BcpPackage [[-Path] <DirectoryInfo>] [[-To] <DirectoryInfo>] [-NoSourceFiles] [<CommonParameters>]

Parameters

Type

Name

Description

Default value

Optional

DirectoryInfo

Path

Directory of the opened BCP package that should get exported

The last opened BCP package

yes

DirectoryInfo

To

Destination directory that will containing the VaultBCP xml files

The directory ‘.\Export’ or the current directory ‘.’ when the package got opened by reusing an existing internal Database

yes

SwitchParameter

No SourceFiles

The export package will be created without links to the real files

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 where the exported BCP package is located
$result.DatabaseLocation ← The location to the internal Database-file of the exported BCP package (only specified when the exported BCP package is opened)

Remarks

The cmdlet exports the previously opened BCP package to a destination directory.
When multiple BCP packages are opened simultaneously the Path to the desired BCP package can be specified.

The internal Database becomes exported to the destination directory requested in the To parameter.
When the specified directory does not exist it will be automatically generated.

For testing purpose it can be useful to export the package with the NoSourceFiles parameter, in order to get a package that can be imported into Vault without the need for the real files.

Examples

In the following examples we are using our VaultBcp 2024 sample package for demonstration purposes:
Exporting the previously opened BCP package

Open-BcpPackage -Path 'C:\Temp\bcp_samplepackage'
#...
Export-BcpPackage -To 'C:\Temp\bcp_samplepackage\Export_01'

Exporting several opened BCP packages

Open-BcpPackage -Path 'C:\Temp\bcp_samplepackage'
Open-BcpPackage -Path '.\bcp_customerpackage' -Version 2024 -IgnoreBomBlobs

Export-BcpPackage -Path 'C:\Temp\bcp_samplepackage' '.\bcp_customerpackage' | Export-BcpPackage

Validating if the BCP package got exported correctly

$exportPackageResult = Export-BcpPackage -To 'P:\laplapla'
if(-not $exportPackageResult ) {
	throw "Failed with error: " + $exportPackageResult.Error.Message
}

Exporting a BCP package to a relative path and using the export result

$exportPackageResult = 'C:\Temp\bcp_samplepackage' | Export-BcpPackage -To '.\Export_02'

write-host "Exported package to '$($exportPackageResult.Location.Fullname)'..."
write-host "Version: '$([int]$exportPackageResult.Version)'"