Open Forum

Expand all | Collapse all

Running Powershell scripts from NAV

  • 1.  Running Powershell scripts from NAV

    Posted 9 days ago
    Edited by Steven Sirulnick 9 days ago

    I have a powershell script that I would like to use but I would like to call it from within NAV, feeding the powershell script a parameter to complete the rest of the work needed.  After the script has run, it will return a value back to the calling program.

    Has anyone ever done this with success?  If so, where might I go to obtain additional research on this?  I am running NAV 2018.

    Many thanks in advance.



    ------------------------------
    Steven Sirulnick
    IronMan
    Tampa FL
    ------------------------------
    Conference-BCNAVUG_200x200


  • 2.  RE: Running Powershell scripts from NAV

    TOP CONTRIBUTOR
    Posted 8 days ago
    ​Have you tried this?

    https://community.dynamics.com/nav/b/moxie4nav/posts/executing-external-programs

    ------------------------------
    Samuel Champoux
    IT Director
    Drummondville QC Canada
    ------------------------------

    Conference-BCNAVUG_200x200


  • 3.  RE: Running Powershell scripts from NAV

    Posted 2 days ago
    I have used this blog to create my DotNet data types and call powershell.  It works just fine when I run this from a codeunit, but the powershell actually freezes and locks the file when run in the job queue.

    ------------------------------
    Steven Sirulnick
    IronMan
    Tampa FL
    ------------------------------

    Conference-BCNAVUG_200x200


  • 4.  RE: Running Powershell scripts from NAV

    SILVER CONTRIBUTOR
    Posted 8 days ago
    ​Hi Steve,

    I've used PowerShell to call NAV Code, but never used NAV to call PowerShell.

    I'm guessing that you would likely need to use DotNet Data Types to accomplish this.  If you do a search online for calling PowerShell with C# you will likely get a number of hits.

    Can you give some more detail on what you are trying to accomplish?

    Thanks,

    Joe

    ------------------------------
    Joe Draeger
    Ortho Molecular Products, Inc
    Woodstock IL
    ------------------------------

    Conference-BCNAVUG_200x200


If you've found this thread useful, dive deeper into User Group community content by role