In Microsoft Dynamics NAV 2017 there a currently five Cmdlets to administer companies:
Copy-NAVCompany Get-NAVCompany New-NAVCompany Remove-NAVCompany Rename-NAVCompany
In order to run these Cmdlets we need to start ‘PowerShell ISE’ as an Administrator. Now import the NAV Administration module in order to use the NAV PowerShell Cmdlets.
I will show you how to perform the following tasks:
- Show all companies
- Copy a company
- Rename a company
- Create a new company
- Delete the new company
For these tasks to accomplish you must use the following Cmdlets:
Import-Module 'C:\Program Files\Microsoft Dynamics NAV\100\Service\NavAdminTool.ps1' $ServerInstance = 'NST2017RTM' # Modify to the name of your server instance Get-NAVCompany -ServerInstance $ServerInstance # Show all companies Copy-NAVCompany -ServerInstance $ServerInstance -SourceCompanyName 'CRONUS Nederland BV' -DestinationCompanyName 'CRONUS International' # Copy an existing company to a new company Rename-NAVCompany -ServerInstance $ServerInstance -CompanyName 'CRONUS International' -NewCompanyName 'CRONUS Worldwide Enterprises' # Rename the copied company New-NAVCompany -ServerInstance $ServerInstance -CompanyName 'CRONUS Europe' # Create a new company Remove-NAVCompany -ServerInstance $ServerInstance -CompanyName 'CRONUS Europe' # Delete a company
If you are operating NAV in a Multi-Tenant setup then you must also specify the Tenant parameter. The ServerInstance parameter is mandatory for all Company Cmdlets.
Of course it’s also possible to accomplish this in the NAV Client: