Company Administration in Powershell

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:

company-administration

 

Advertisements

Are you sure your service is the only one listening to port 13000?

Run netstat -noa | find “13000” before starting your program to identify which process has port 13000 open. The number in the far right-hand column will be the process ID.

Then run tasklist | find “<pid>” where is the ID of the process from the previous command. This will tell you which process has 13000 open.

How to install the NAV Web Client (Web Server Components)

In this article I will explain how to install the Web Server Components for Dynamics NAV 2016.

High-level steps:

1. Install the ‘Web Server Components’ from the Dynamics NAV DVD.
2. Start your internet browser and go to http://localhost:8080.

More detailed steps:
1. Install the ‘Web Server Components’ from the Dynamics NAV DVD.
a. Start Setup.exe from the NAV DVD. Choose Custom and Select the option ‘Web Server Components’:

01

Click Next and leave all settings unchanged:

02

Some of the components that now will be installed:

– IIS Web Server
– IIS URL Rewrite Module 2
– Microsoft Dynamics NAV 2016 Web Client
– Language Module for the Microsoft Dynamics NAV 2016 Web Client

2. Start your internet browser and go to http://localhost:8080
a. Start ‘Internet Explorer’ and type in the URL: http://localhost:8080 You will now see the following:

03

b. You must add the name of your default service tier (NAV Instance) to the URL.

In my case it is ‘NST90Test’ so the URL will be:

http://localhost:8080/NST90Test/

04

 

If you want to simulate a Tablet Client in your browser go to http://localhost:8080/NST90Test/tablet.aspx
If you want to simulate a Phone Client in your browser go to http://localhost:8080/NST90Test/phone.aspx

The steps in this article only work if you install the Web Server Components on the same machine as your Dynamics NAV Server. The steps are quite easy in my opinion. Want to install the Web Client on another server? Then additional configuration is needed. You can find more info about it on MSDN ‘Walkthrough: Installing the Microsoft Dynamics NAV Web Server Components on Three Computers‘. If you install the NAV App on your tablet or smartphone it will not work because certificates are mandatory and more configuration is required then. Keep checking this site for more information about how to accomplish these things! More info will be added regularly.