Use the Export-NAVData cmdlet to export data from a Business Central database.
You can export company-specific data, and you can choose to include global data, application data, and application objects.
When you export data from a Business Central database, the data is stored in a file with the extension .navdata.
This file cannot be modified in external tools.
The data that you export is not deleted from the original database.
The cmdlet takes different parameter sets depending on how you connect to the database that you want to export data from.
You can access the database through the Business Central Server instance, or you can access the database directly.
You can use the Export-NAVData cmdlet to transfer data between installations.
We recommend that you use SQL Server management tools to back up and restore databases.
To import data from a file, use the Import-NAVData cmdlet.
This example exports all companies from the specified database that is mounted against the specified Business Central Server instance in a single-tenant deployment of Business Central.
EXAMPLE 2
Export-NAVData -ServerInstance BC -Tenant "Tenant1" -CompanyName 'Company A', 'Company B' -FilePath C:\file\Companies.navdata -DatabaseCredentials (Get-Credential)
This example exports the two specified companies from the specified tenant database in a multitenant deployment of Business Central.
The Business Central Server instance is configured for SQL authentication with the database.
Parameters
-AllCompanies
Specifies if you want to export all companies in the database to the specified file.
Parameter properties
Type:
SwitchParameter
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
UseNST_AllCompanies
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
UseDatabase_AllCompanies
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-ApplicationDatabaseCredentials
Specifies the user name and password of an SQL Server Authentication login account that provides access to the application database in SQL Server.
You use this parameter to access the database by using SQL Server Authentication.
If you want to use Windows Authentication, then you can omit this parameter.
The login account must be a member of the db_owner role on the database.
Parameter properties
Type:
PSCredential
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
UseDatabase_SomeCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
UseDatabase_AllCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-ApplicationDatabaseName
Specifies the name of the Business Central database that contains the application tables in a multitenant deployment.
You must also set the ApplicationDatabaseServer parameter.
Even if you are not exporting data from the application database, you must specify this parameter.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
UseDatabase_SomeCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
UseDatabase_AllCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-ApplicationDatabaseServer
Specifies the name of the computer on which the SQL Server instance for the Business Central database that contains the application tables is installed in a multitenant deployment.
Even if you are not exporting data from the application database, you must specify this parameter.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
UseDatabase_SomeCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
UseDatabase_AllCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-CompanyName
Specifies the name of the company or the companies that you want to export.
If the company does not exist in the file, the operation fails.
Parameter properties
Type:
String[]
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
UseDatabase_SomeCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
UseNST_SomeCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type:
SwitchParameter
Default value:
None
Supports wildcards:
False
DontShow:
False
Aliases:
cf
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-DatabaseCredentials
Specifies the user name and password for an SQL Server Authentication login account that provides access to the database or tenant database (in a multitenant deployment) in SQL Server.
You use this parameter to access the database by using SQL Server Authentication.
If you want to use Windows Authentication, then you can omit this parameter.
The login account must be a member of the db_owner role on the database.
Parameter properties
Type:
PSCredential
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
UseDatabase_SomeCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
UseDatabase_AllCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-DatabaseName
The name of the Business Central database that contains the data that you want to export, such as 'Demo Database NAV'.
In a multitenant deployment, this is the name of the tenant database, and you must also specify the tenant ID in the Tenant parameter.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Aliases:
TenantDatabaseName
Parameter sets
UseDatabase_SomeCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
UseDatabase_AllCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-DatabaseServer
Specifies the name of the computer on which the SQL Server instance for the Business Central database is installed.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Aliases:
TenantDatabaseServer
Parameter sets
UseDatabase_SomeCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
UseDatabase_AllCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Description
Specifies a description of the data that you want to export, such as 'My Application Database'.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-FilePath
Specifies the name and location of the file that you want to export data to.
The data is exported to a file with the extension .navdata.
If you use parameter sets that include -ServerInstance, the user account for the Business Central Server instance must have write access to the location that is specified by the -FilePath parameter.
If you use parameter sets that include -DatabaseServer, you must have write access to the location that is specified by the -FilePath parameter.
Although you can export the file to the user profile folder on your computer, like C:\Users\[user_name], which includes folders like Documents and Desktop, be aware that you can't use the Import-NAVData cmldet to import the file from these locations. You'll have to move the file to another folder in the root directory.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Aliases:
FileName
Parameter sets
(All)
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-Force
Forces the command to run without asking for user confirmation.
Parameter properties
Type:
SwitchParameter
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-IncludeApplication
Specifies that you want to include application objects in the export.
If you do not set the parameter, application objects are not included in the export.
Parameter properties
Type:
SwitchParameter
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-IncludeApplicationData
Specifies that you want to include application data in the export.
If you do not set the parameter, application data is not included in the export.
Parameter properties
Type:
SwitchParameter
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-IncludeGlobalData
Specifies that you want to include global data in the export.
If you do not set the parameter, global data is not included in the export.
Parameter properties
Type:
SwitchParameter
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-ServerInstance
Specifies the name of a Business Central Server instance, for example, BC or myinstance.
You can specify either the full name of an instance, such as MicrosoftDynamicsNavServer$myinstance or the short name such as myinstance.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
UseNST_AllCompanies
Position:
0
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
True
Value from remaining arguments:
False
UseNST_SomeCompanies
Position:
0
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
True
Value from remaining arguments:
False
-SqlCommandTimeout
Specifies the maximum amount of time allowed for any SQL operation that is part of the export. The value has the format hh:mm:ss, and the default is 00:30:00. If the time is exceeded, an error occurs and the export will fail. This parameter applies only when exporting directly from the database without specifying a server instance. It has the same effect as the server instance's SqlCommandTimeout setting when exporting using a server instance.
Parameter properties
Type:
TimeSpan
Default value:
00:00:00
Supports wildcards:
False
DontShow:
False
Parameter sets
UseDatabase_SomeCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
UseDatabase_AllCompanies
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-Tenant
Specifies the ID of the tenant that the company is imported into, such as Tenant1.
This parameter is required in multitenant deployments of Business Central.
Parameter properties
Type:
TenantId
Default value:
None
Supports wildcards:
False
DontShow:
False
Aliases:
Id
Parameter sets
UseNST_AllCompanies
Position:
1
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
UseNST_SomeCompanies
Position:
1
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
Type:
SwitchParameter
Default value:
None
Supports wildcards:
False
DontShow:
False
Aliases:
wi
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.