Hands On With Microsoft Dynamics GP 2015 R2: Create Company Using GP PowerShell

Microsoft Dynamics GPMicrosoft Dynamics GP 2015 R2 was released at the end of May. As I mentioned at the time, I was away from home for work and rather busy otherwise so this series of posts has been somewhat delayed.

However, I am now getting my hands on GP 2015 R2 and thought I would do my usual set of posts on the installation of the various components and also the usage of the new functionality. This is going to be quite a long series of posts, so keep checking back regularly.

Microsoft Dynamics GP 2015 R2 saw the introduction of some additional PowerShell cmdlets. I thought it might be useful to select one of the new cmdlets and give a run through of using it.

One of the tasks I often do a lot of is creating new companies so I have selected the Add-CompanyDatabase cmdlet.

To run any of the cmdlets, launch GP PowerShell from the Start screen.

The easiest way of finding out the parameters to use is to enter the following command:

Get-Help Add-CompanyDatabase

Get-Help Add-CompanyDatabase

This will display the details of the cmdlet including the Synopsis, Syntax, Description, Related Links and Remarks.

As you can see, not all of the parameters are required, but even some of the optional ones I would suggest supplying.

These would include the SQL MDF and LDF paths as I find that GP Utilities defaults to the SQL Server installation folder rather than the defaults selected during the install.

Below is an example of how to use the cmdlet to add a new company:

Add-CompanyDatabase

Add-CompanyDatabase -GPClientDirectory "C:\Program Files (x86)\Microsoft Dynamics\GP2015" -SqlAdmin "sa" -SqlAdminPassword "password" -SqlServerName "2015R2\GP" -CompanyName "azurecurve Publishing" -CompanyDbName "A15R2"-SqlMdfFilePath "C:\SQLServer\Data\" -SqlMdfFileName "GPSA15R2Dat.mdf" -SqlLdfFilePath "C:\SQLServer\Data\" -SqlLdfFileName "GPSA15R2Dat.ldf"

The supplied parameters and their values are:

  • -GPClientDirectory “C:\Program Files (x86)\Microsoft Dynamics\GP2015”
  • -SqlAdmin “sa”
  • -SqlAdminPassword “password”
  • -SqlServerName “2015R2\GP”
  • -CompanyName “azurecurve Publishing”
  • -CompanyDbName “A15R2”
  • -SqlMdfFilePath “C:\SQLServer\Data\”
  • -SqlMdfFileName “GPSA15R2Dat.mdf”
  • -SqlLdfFilePath “C:\SQLServer\Data\”
  • -SqlLdfFileName “GPSA15R2Dat.ldf”/li>

The text between the quotes would be replaced with the values you want to use to create the company.

Enter the cmdlet and parameters into GP PowerShell and hit return and the cmdlet will launch GP Utilities and create the new company; if you have any missing parameters or errors the launch will fail (usually with a less than helpful message).

Click to show/hide the Hands On With Microsoft Dynamics GP 2015 R2 Series Index

What should we write about next?

Your Name (required) -
Your Email (required) -

(Visited 315 times, 1 visits today)

6 thoughts on “Hands On With Microsoft Dynamics GP 2015 R2: Create Company Using GP PowerShell

  1. Leslie Vail says:

    Where do you get the Add-CompanyDatabase cmdlet? When I install PowerShell, I do not get that one. I’m using the install from the DVD.
    Kind regards,
    leslie

    1. Ian Grieve Ian Grieve says:

      Hi Leslie,

      It is one of the cmd-lets which is installed as part of GP Powershell. I didn’t do anything special to get it.

Leave a Reply

Your email address will not be published. Required fields are marked *