Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Using PowerShell ISE

Posted on by Microsoft Employee

Hi All,

I use power shell to add new server instance , I have installed couple version of Nav 2015,2016 I want to add instance to Nav 2015 but always when I run the script new instance is created with the newest version of navision, What should I change to create instance with nav 2015 version. this is my script

Import-Module "c:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1" -force
$ServiceAccountCredential = Get-Credential -Username Test\test -Message "Provide user name and password for NAS service"
New-NAVServerInstance -ManagementServicesPort 7045 -ServerInstance NASTier2 -ServiceAccount User -ServiceAccountCredential $ServiceAccountCredential

Thx

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Using PowerShell ISE

    Thanks for help

  • Verified answer
    keoma Profile Picture
    keoma 32,675 on at
    RE: Using PowerShell ISE

    run windows powershell ise.

    there run "Import-Module 'C:\Program Files\Microsoft Dynamics NAV\80\Service\NavAdminTool.ps1'" in the shell to get the nav admin cmdlets.

    if that does not work you may get an error message like that: Import-Module 'C:\Program Files\Microsoft Dynamics NAV\80\Service\NavAdminTool.ps1' cannot be loaded, because the execution of scripts is not allowed on that system.

    in that case run "Get-ExecutionPolicy -List" to get a list of the current policies:

    result could be like that:

    Scope ExecutionPolicy

           ----- ---------------

    MachinePolicy       Undefined

      UserPolicy       Undefined

         Process       Undefined

     CurrentUser       Undefined

    LocalMachine       Undefined

    in that case run following command: "Set-ExecutionPolicy RemoteSigned -Scope CurrentUser"

    for the details how to work with execution policies follow: [View:https://technet.microsoft.com/en-US/library/hh847748.aspx:750:50]

    now you can try again and should get the list of the imported cmdlets as result.

    alternatively you can run nav 2015 admin shell. to create a nav service instance it's needed to run the shell in admin mode. if the new-navserviceinstance cmdlet is missing import the module NavAdminTool.ps1 as shown above.

    to create a new nav service instance run "New-NAVServerInstance" + ENTER, set the 2 mandatory parameters ManagementServicesPort and ServiceInstance, done

    ... or run the cmdlet directly with all your needed parameters.

    syntax: New-NAVServerInstance [-ServerInstance] <String> -ManagementServicesPort <Int> [-ClientServicesCredentialType <String> ] [-ClientServicesPort <Int> ] [-DatabaseInstance <String> ] [-DatabaseName <String> ] [-DatabaseServer <String> ] [-Force] [-ODataServicesPort <Int> ] [-ServiceAccount <ServiceAccount> ] [-ServiceAccountCredential <PSCredential> ] [-ServicesCertificateThumbprint <ClientServicesCertificateThumbprint> ] [-SOAPServicesPort <Int> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

    and follow: [View:https://msdn.microsoft.com/en-us/library/jj672911(v=nav.80).aspx:750:50]

    now start the nav 2015 administration tool to check and finish the new instances settings.

    the module c:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1 does not import cmdlets for administration purposes but for merge purposes.

    for details please follow: [View:https://msdn.microsoft.com/en-us/library/dn762354(v=nav.90).aspx:750:50]

    module1.PNG

  • Suggested answer
    RE: Using PowerShell ISE

    Hi,

    Use this to import-module.

    Import-Module 'C:\Program Files\Microsoft Dynamics NAV\90\Service\NavAdminTool.ps1' -force

    I have NAV 2013, 2016, and 2017 limited beta.

    I imported the NAV 2016 NavAdminTool which is 90 folder, after creating the instance, I tried to start that from NAV 2017 Admin console, it popped me an error but worked in NAV 2016 admin console, which was expected.

    Hope it helps.

  • Suggested answer
    Jatin Patel Profile Picture
    Jatin Patel 2,641 on at
    RE: Using PowerShell ISE

    Hi,

    On my system i have installed NAV 2013,2013R2,2015 and 2016 version. And i have created service with your command it created for NAV 2015 version.

    Please reopen PowerShell ISE then import and run "C:\Program Files\Microsoft Dynamics NAV\80\Service\NavAdminTool.ps1" and try again.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans