title | nav_order |
---|---|
Business Central Powershell |
3 |
{: .no_toc }
{: .no_toc .text-delta }
- TOC {:toc}
Import-Module "C:\Program Files\Microsoft Dynamics 365 Business Central\140\Service\NAVAdminTool.ps1" -force
Import-Module "C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\140\RoleTailored Client\NAVModelTools.ps1" -force
$serverInstance = "PT_BC_CU2"
$extensionName = "Extension1"
$extensionVersion = "1.0.0.0"
Get-NAVAppInfo -ServerInstance -Tenant
Skip the tenant parameter to see all tenant extensions.
Get-NAVAppInfo -ServerInstance $serverInstance
Publish-NAVApp -ServerInstance -Path
Publish-NAVApp -ServerInstance $serverInstance -Path 'C:\Temp\navapp.app'
Install-NAVApp -ServerInstance -Name -Version
Install-NAVApp -ServerInstance $serverInstance -Name $extensionName -Version $extensionVersion
Uninstall-NAVApp -ServerInstance -Name -Version
Uninstall-NAVApp -ServerInstance $serverInstance -Name $extensionName -Version $extensionVersion
Get-NAVAppInfo -ServerInstance $serverInstance -Tenant default | % { Uninstall-NAVApp -ServerInstance $serverInstance -Name $_.Name -Version $_.Version }
Unpublish-NAVApp -ServerInstance -Name -Version
Unpublish-NAVApp -ServerInstance $serverInstance -Name $extensionName -Version $extensionVersion
New-NavServerUser -WindowsAccount -ServerInstance New-NavServerUserPermissionSet -WindowsAccount -ServerInstance -PermissionSetId
New-NavServerUser -WindowsAccount 'domain.local\ricardo' -ServerInstance $serverInstance
New-NavServerUserPermissionSet -WindowsAccount 'domain.local\ricardo' -ServerInstance $serverInstance -PermissionSetId SUPER
Imports a license file into a Business Central database
Import-NAVServerLicense -LicenseData ([Byte[]]$(Get-Content -Path "" -Encoding Byte))
Import-NAVServerLicense $serverInstance -LicenseData ([Byte[]]$(Get-Content -Path "$licenseFilePath" -Encoding Byte))
Configures settings for a Business Central Server instance.
Values are written directly to the configuration file for the instance (CustomSettings.config). New setting values do not take effect until you restart the server instance.
Set-NAVServerConfiguration -ServerInstance -KeyName -ServerInstance
- Change serverInstanceName to the name of the instance on the Microsoft Dynamics BC Server instance.
- Change keyName to the configuration key name to be configured. For more info on the available keys check CustomSettings.config file in "C:\Program Files\Microsoft Dynamics 365 Business Central<version>\Service\CustomSettings.config".
- Change keyValue to the value to be set.
- (Optional) Change applyTo to the configuration mode to be used:
- ConfigFile or 0 -> Default: Saves the change to the configuration file of the server instance. The change will not take effect until the server instance is restarted.
- Memory or 1 -> The setting change is just applied to the server instance's current setting state. This is only applicable for server settings which support dynamic updating. If the specified setting is not dynamically updateable this command will fail.
- All or 2 -> Applies the change to the server instance's current setting state (in memory) and to the configuration file. This is only applicable for server settings that support dynamic updating. If the setting does not support dynamic updating, the cmdlet will fail with an error. The change will not be applied to the current session or the configuration file.
Set-NAVServerConfiguration -ServerInstance $serverInstanceName -KeyName $keyName -KeyValue $keyValue -ApplyTo $applyTo
Set-NAVServerConfiguration -ServerInstance bc-w1-22 -KeyName DatabaseServer -KeyValue DatabaseServer.Domain.Com
Get-NAVWebServerInstance
New-NAVWebServerInstance -WebServerInstance -Server -ServerInstance
- Change WebServerInstance to the name that you want to give the virtual directory for the web server instance. This name will become part of the URL for the Microsoft Dynamics BC Web client application, for example, http://MyWebServer:8080/WebServerInstance/WebClient.
- Change BCServer to the name of the computer that is running the Microsoft Dynamics BC Server to which you want to connect (ex. localhost)
- Change ServerInstance to the name of the instance on the Microsoft Dynamics BC Server.
New-NAVWebServerInstance -WebServerInstance $newWebServerInstanceName -Server $BCServer -ServerInstance $serverInstance
New-NAVWebServerInstance -WebServerInstance bc-w1-15 -Server localhost -ServerInstance bc-w1-15
Export-NAVApplicationObject "" -DatabaseServer -ExportTxtSkipUnlicensed
Example: Exports all objects from NAV2015AP-APP-TEST to NAV2015-All-Objects.txt
Export-NAVApplicationObject NAV2015AP-APP-TEST “E:\NAV2015-Objects\All-Objs\NAV2015-All-Objects.txt" -DatabaseServer MYP-RPAIVA\SQL2017 -ExportTxtSkipUnlicensed
Export-NAVApplicationObject "" -Filter '' -DatabaseServer -ExportTxtSkipUnlicensed
Example: Exports codeunits 80..84 from the NAV2015AP-APP-TEST to COD80-84.txt
Export-NAVApplicationObject NAV2015AP-APP-TEST “E:\NAV2015-Objects\All-Objs\NAV2015-All-Objects.txt" -Filter 'Type=Codeunit;Id=80..84' -DatabaseServer MYP-RPAIVA\SQL2017 -ExportTxtSkipUnlicensed
Export-NAVApplicationObject "" -Filter '' -DatabaseServer -DatabaseName -ExportTxtSkipUnlicensed | Split-NAVApplicationObjectFile -Destination ""
Example: Exports all objects and split V2015AP-APP-TEST* to Splitted-Objs folder
Export-NAVApplicationObject "E:\NAV2015-Objects\All-Objs\NAV2015-All-Objects.txt" -DatabaseServer MYP-RPAIVA\SQL2017 -DatabaseName NAV2015AP-APP-TEST -ExportTxtSkipUnlicensed | Split-NAVApplicationObjectFile -Destination "E:\NAV2015-Objects\Splitted-Objs"