Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

PowerShell - NAV commands

Posted on by 511

Hi all,

First attempt to use PowerShell. Trying to type "New-NAVServerInstance", can't find it. Do I need to add any add-ons or install anything?

powershell.png

Microsoft Dynamics NAV 2017

Trying to do something similar like Waldo did in one of his "How Do I videos".

powershell-waldo.png

Thanks,

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: PowerShell - NAV commands

    Running these scripts didn't help me.

    Import-Module "C:\Program Files\Microsoft Dynamics NAV\100\Service\NavAdminTool.ps1"

    Import-Module "C:\Program Files (x86)\Microsoft Dynamics NAV\100\RoleTailored Client\NavModelTools.ps1"

    We currently have both NAV2009 and NAV2017.

    NAV2009 is on Prem but being replaced by NAV2017 in hosted remotely be a 3rd party company.

    The server has the NAVAdminTool.ps1 but not the NAVModelTools.ps1 located at \\RemoteServer\c$\Program Files\Microsoft Dynamics NAV\100\Service\NAVAdminTool.ps1

    Locally, NAV2017 is installed at C:\NAV201764BIT\RoleTailored Client\ .

    There are no *.ps1 in this whole directory on the C Drive, how do I get the registry to look at the powershell scripts?

     

    How can I import it from a remote server?

    Can I copy the NavAdminTool.ps1 file and paste it on My C Drive and import the module there?

    I did try this but received the following error message:

    "

    Welcome to the Server Admin Tool Shell!
    For a complete list of Server cmdlets type

    Get-Command -Module Microsoft.Dynamics.Nav.Management, Microsoft.Dynamics.Nav.Apps.Management

    Get-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\Microsoft Dynamics NAV\100\Service' because it does not exist.

    At C:\Program Files (x86)\Microsoft Dynamics NAV\100\Service\NavAdminTool.ps1:17 char:32

    + ...  $snapInAssembly = Join-Path (Get-ItemProperty -path $nstPath).Path " ...

    +                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

       + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...NAV\100\Service:String) [Get-ItemProperty], ItemNotFoundException

       + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand

    Join-Path : Cannot bind argument to parameter 'Path' because it is null.

    At C:\Program Files (x86)\Microsoft Dynamics NAV\100\Service\NavAdminTool.ps1:17 char:31

    + ... InAssembly = Join-Path (Get-ItemProperty -path $nstPath).Path "\$snap ...

    +                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

       + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException

       + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

    Test-Path : Cannot bind argument to parameter 'Path' because it is null.

    At C:\Program Files (x86)\Microsoft Dynamics NAV\100\Service\NavAdminTool.ps1:18 char:18

    +   if(!(Test-Path $snapInAssembly)) { $snapInAssembly = Join-Path (Get ...

    +                  ~~~~~~~~~~~~~~~

       + CategoryInfo          : InvalidData: (:) [Test-Path], ParameterBindingValidationException

       + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.TestPathCommand

    Import-Module : Cannot bind argument to parameter 'Name' because it is null.

    At C:\Program Files (x86)\Microsoft Dynamics NAV\100\Service\NavAdminTool.ps1:21 char:17

    +   Import-Module $snapInAssembly -ErrorVariable errorVariable -ErrorAc ...

    +                 ~~~~~~~~~~~~~~~

       + CategoryInfo          : InvalidData: (:) [Import-Module], ParameterBindingValidationException

       + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ImportModuleCommand

    Get-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\Microsoft Dynamics NAV\100\Service' because it does not exist.

    At C:\Program Files (x86)\Microsoft Dynamics NAV\100\Service\NavAdminTool.ps1:17 char:32

    + ...  $snapInAssembly = Join-Path (Get-ItemProperty -path $nstPath).Path " ...

    +                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

       + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...NAV\100\Service:String) [Get-ItemProperty], ItemNotFoundException

       + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand

    Join-Path : Cannot bind argument to parameter 'Path' because it is null.

    At C:\Program Files (x86)\Microsoft Dynamics NAV\100\Service\NavAdminTool.ps1:17 char:31

    + ... InAssembly = Join-Path (Get-ItemProperty -path $nstPath).Path "\$snap ...

    +                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

       + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException

       + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

    Test-Path : Cannot bind argument to parameter 'Path' because it is null.

    At C:\Program Files (x86)\Microsoft Dynamics NAV\100\Service\NavAdminTool.ps1:18 char:18

    +   if(!(Test-Path $snapInAssembly)) { $snapInAssembly = Join-Path (Get ...

    +                  ~~~~~~~~~~~~~~~

       + CategoryInfo          : InvalidData: (:) [Test-Path], ParameterBindingValidationException

       + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.TestPathCommand

    Import-Module : Cannot bind argument to parameter 'Name' because it is null.

    At C:\Program Files (x86)\Microsoft Dynamics NAV\100\Service\NavAdminTool.ps1:21 char:17

    +   Import-Module $snapInAssembly -ErrorVariable errorVariable -ErrorAc ...

    +                 ~~~~~~~~~~~~~~~

       + CategoryInfo          : InvalidData: (:) [Import-Module], ParameterBindingValidationException

       + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ImportModuleCommand

    "

    Thanks in advance

  • Zaid Tariq Profile Picture
    Zaid Tariq 2,266 on at
    RE: PowerShell - NAV commands

    Great, glad to hear.

  • Verified answer
    Christos Christou Profile Picture
    Christos Christou 511 on at
    RE: PowerShell - NAV commands

    I upgraded my windows home to windows pro edition and web components have been installed successfully.

  • Verified answer
    Christos Christou Profile Picture
    Christos Christou 511 on at
    RE: PowerShell - NAV commands

    Thanks Zaid. I think the problem is that i am on Windows 10 HOME - I wont be able to install web server components. I would need Windows 10 PRO Edition for that. Let me do that and update you. :)

  • Verified answer
    Christos Christou Profile Picture
    Christos Christou 511 on at
    RE: PowerShell - NAV commands

    Thanks Roberto. I think the problem is that i am on Windows 10 HOME - I wont be able to install web server components. I would need Windows 10 PRO Edition for that. Let me do that and update you. :)

  • Suggested answer
    Roberto Stefanetti Profile Picture
    Roberto Stefanetti 12,998 on at
  • Verified answer
    Zaid Tariq Profile Picture
    Zaid Tariq 2,266 on at
    RE: PowerShell - NAV commands

    Well, It seems like you missed something.

    Can you please verify the following:

    - .Net framework 3.5/4.5

    - IIS (rewrite component) installed successfully,

    - HTTP Activation is selected.

    If so try pc restart and then reinstall NAV components.

    Let me know in either case. Thanks

  • Christos Christou Profile Picture
    Christos Christou 511 on at
    RE: PowerShell - NAV commands

    Now I am in the process of installing Web Server components but I am getting an error. See image below

    web-server-components-NAV-2017.png

    P.S I installed IIS features based on this article https://msdn.microsoft.com/en-us/library/hh167503(v=nav.90).aspx#Win8

    I also made sure ports 7045, 7046, 7047, 7048 are not used in my instances. 

    What's wrong with it?

    Thanks,

  • Suggested answer
    Christos Christou Profile Picture
    Christos Christou 511 on at
    RE: PowerShell - NAV commands

    Great. It worked. Thanks Zaid!

  • Verified answer
    Zaid Tariq Profile Picture
    Zaid Tariq 2,266 on at
    RE: PowerShell - NAV commands

    Hi,

    - First, Make sure you run powershell as administration.

    - Run Following commands:

    Import-Module "C:\Program Files\Microsoft Dynamics NAV\100\Service\NavAdminTool.ps1"

    Import-Module "C:\Program Files (x86)\Microsoft Dynamics NAV\100\RoleTailored Client\NavModelTools.ps1"

    These commands are for NAV 2017 but if you are on 2016 change them accordingly like change 100 to 90

    Thanks

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans