Using powershell to run on the application server

engsiong75engsiong75 Member Posts: 143
edited 2014-06-09 in NAV Three Tier
Hi

I recently wrote a program that ran the a powershell script in NAV 2013 R2. There is no problem with the program. It runs perfectly on the application server.

My mistake was that I assumed that all program logic ran on the application server including the powershell script. :( It turn out that the powershell script instead ran on the client machine. As a result, the program failed when the users tried it out. It works as long as the user is on the application server.

I tried changing the path of the script so that it calls the application server but it failed with error message stating that the network path was not found.

Is there way to get the program to run the powershell script on the application server?

Thank you,

Comments

  • kinekine Member Posts: 12,562
    Depends on how you are running the script. If you are using RunOnClient dotnet, or automations. These things are running on client, not server...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • engsiong75engsiong75 Member Posts: 143
    So is there a way to run a script from the application server?

    Thanks you,
  • kinekine Member Posts: 12,562
    I do not know. If you run the script in a way that it doesn't display anything, you should be able to do that...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • engsiong75engsiong75 Member Posts: 143
    Hi

    Fact: Confirmed. There is currently no solution to get the automation working on the server. See path below.
    http://msdn.microsoft.com/en-us/library ... 5(v=nav.70).aspx

    I found the workaround. By allowing the users to have access to the folder in questions (Sharing the folder and given the users to have read and write permission.), and using a UNC path to get the program to I got the powerscript to run on the application server.

    Thank you,
  • kinekine Member Posts: 12,562
    It means you are using Automation? Than try to use dotnet assembly...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.