1. mike S
  2. PowerServer 2020 or older (Obsolete)
  3. Friday, 25 March 2022 15:30 PM UTC

powerServer 2020

 

I can send a commandline to start a process in my powerserver application:   

something like this:

https://mywebserver.com/?/U myuuser /P mypwrd /R exportfile {"rptl_cd":"xyz","format":"CSV","file":"c:\temp\myfile[MMDDhhmmssss00].csv"}

 

when i  manually copy that into a browser (edge, chrome, etc). it runs the process fine.

 

 

I need to run this from a scheduler.

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

powershell:

I have a powershell script that sends the command, but stops immediately.  It returns status code 200 and appears to exit out without waiting for the powerserver application to finish the process.  does not work on either scheduler or command line (both just return 200 without doing the process)

powershell -ExecutionPolicy Bypass -Command Invoke-WebRequest -UseBasicParsing 'http://mywebserver.com/?/U myuuser /P mypwrd /R exportfile {"rptl_cd":"xyz","format":"CSV","file":"c:\temp\myfile[MMDDhhmmssss00].csv"}' 

 

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

the start command 

start https://mywebserver.com/?/U%20myuuser%20/P%20mypwrd%20/R%20exportfile %20{"rptl_cd":"xyz","format":"CSV","file":"c:\temp\myfile[MMDDhhmmssss00].csv"}

 

works from the command line, but doesn't from the scheduler: (scheduler runs it, says everything is good, but the file does not get saved out, scheduler is run under my user account).

(Note that %20 must be used instead of spaces for the command line to the web address)

cmd /c 

start https://mywebserver.com/?/U%20myuuser%20/P%20mypwrd%20/R%20exportfile %20{"rptl_cd":"xyz","format":"CSV","file":"c:\temp\myfile[MMDDhhmmssss00].csv"}

 

anyone have any ideas?  anyone else run a command line process to PS 2020 or prior from a scheduler?

 

 

Accepted Answer
mike S Accepted Answer Pending Moderation
  1. Sunday, 27 March 2022 13:22 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # Permalink

My problem is that you must run the task as interactive in task scheduler: "Run only when user is logged on"

running it as: "run whether user is logged on or not" is causing it to either simply fail, or to hang.

I assume that the browser (edge) is somehow waiting for user response.  Maybe other browsers don't have this as a problem.  I'm going to play with powershell again as it might still be workable.

 

A few other things:

Just like a space must be encode to %20, using " in a batch file must also be converted to encoded, so that changes to %22.  I actually have an option to send a file that has all of that stuff in a simple file to read and that is easier to setup. 

The other thing i found is that in a batch/command file the browser doesn't like %20 and you have to send it as %2 which makes no sense.

eventually I plan on converting this to a web service call using topwizweb to run the powerscript based webservice and then using powershell to call it rather than the browser directly.  that should solve most of my problems.

 

Comment
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.