Microsoft Dynamics GP PowerShell has a number of cmdlets which can be used to administer Microsoft Dynamics GP. Before you can use them GP PowerShell needs to be installed.
The following command can be used to return all available cmdlets for Dynamics GP PowerShell:
Get-Command -module GP2016
The following example shows how GP PowerShell can be used to create a new company:
Add-CompanyDatabase -GPClientDirectory "C:\Program Files (x86)\Microsoft Dynamics\GP2016" -SqlAdmin "sa" -SqlAdminPassword "password" -SqlServerName "2016R1-SQL\GP" -CompanyName "azurecurve Publishing" -CompanyDbName "A16R1"-SqlMdfFilePath "C:\SQL Server\Data\" -SqlMdfFileName "GPSA16R1Dat.mdf" -SqlLdfFilePath "C:\SQL Server\Data\" -SqlLdfFileName "GPSA16R1Dat.ldf"
The supplied parameters and their values are:
- -GPClientDirectory “C:\Program Files (x86)\Microsoft Dynamics\GP2016”
- -SqlAdmin “sa”
- -SqlAdminPassword “password”
- -SqlServerName “2016R1-SQL\GP”
- -CompanyName “azurecurve Publishing”
- -CompanyDbName “A16R1”
- -SqlMdfFilePath “C:\SQLServer\Data\”
- -SqlMdfFileName “GPSA16R1Dat.mdf”
- -SqlLdfFilePath “C:\SQLServer\Data\”
- -SqlLdfFileName “GPSA16R1Dat.ldf”
You would replace the text between the quotation marks 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).