Export-NAVData

Exports data from a Business Central database.

Syntax

Export-NAVData
      [-DatabaseServer <String>]
      [-DatabaseName <String>]
      [-DatabaseCredentials <PSCredential>]
      [-ApplicationDatabaseServer <String>]
      [-ApplicationDatabaseCredentials <PSCredential>]
      [-ApplicationDatabaseName <String>]
      -FilePath <String>
      [-Description <String>]
      [-IncludeApplication]
      [-IncludeApplicationData]
      [-IncludeGlobalData]
      [-CompanyName <String[]>]
      [-SqlCommandTimeout <TimeSpan>]
      [-Force]
      [-ProgressAction <ActionPreference>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Export-NAVData
      [-ServerInstance] <String>
      [[-Tenant] <TenantId>]
      -FilePath <String>
      [-Description <String>]
      [-IncludeApplication]
      [-IncludeApplicationData]
      [-IncludeGlobalData]
      [-AllCompanies]
      [-Force]
      [-ProgressAction <ActionPreference>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Export-NAVData
      [-ServerInstance] <String>
      [[-Tenant] <TenantId>]
      -FilePath <String>
      [-Description <String>]
      [-IncludeApplication]
      [-IncludeApplicationData]
      [-IncludeGlobalData]
      [-CompanyName <String[]>]
      [-Force]
      [-ProgressAction <ActionPreference>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Export-NAVData
      [-DatabaseServer <String>]
      [-DatabaseName <String>]
      [-DatabaseCredentials <PSCredential>]
      [-ApplicationDatabaseServer <String>]
      [-ApplicationDatabaseCredentials <PSCredential>]
      [-ApplicationDatabaseName <String>]
      -FilePath <String>
      [-Description <String>]
      [-IncludeApplication]
      [-IncludeApplicationData]
      [-IncludeGlobalData]
      [-AllCompanies]
      [-SqlCommandTimeout <TimeSpan>]
      [-Force]
      [-ProgressAction <ActionPreference>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

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.

Examples

EXAMPLE 1

Export-NAVData -DatabaseServer 'MyServer' -DatabaseName 'Demo Database NAV' -AllCompanies -FilePath C:\file\Companies.navdata

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.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters: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.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters: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.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters: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.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters: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.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:String
Aliases:TenantDatabaseName
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DatabaseServer

Specifies the name of the computer on which the SQL Server instance for the Business Central database is installed.

Type:String
Aliases:TenantDatabaseServer
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Description

Specifies a description of the data that you want to export, such as 'My Application Database'.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters: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.

Type:String
Aliases:FileName
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters: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.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters: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.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ProgressAction

A common PowerShell parameter that determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider. Learn more.

Type:ActionPreference
Aliases:proga
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters: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.

Type:TimeSpan
Position:Named
Default value:00:00:00
Required:False
Accept pipeline input:True
Accept wildcard characters: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.

Type:TenantId
Aliases:Id
Position:1
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False