Support forum
10:12 am
Hello Henk,
Diafaan says the powershell completes, but could very well be something not completing and then making it stuck.
Our current fix is that we run the "Start-Process" from Task Scheduler, then we know the user. So far no issues and we haven't restarted.
Also heads up the mail I got when post was approved gave me the hyperlink:
[*Link removed*]
It is possible to start a process in the script as another user (with the C# 'System.Diagnostics.Process' class). The stackoverflow post also refers to another method to start a process as another user: https://stackoverflow.com/a/15688675/1687106
You can also run the Diafaan SMS Server service with an administrator account, an administrator account has more rights than a local system account and that can sometimes solve some issues.
However, if the user account of the calling process was the issue then I would expect that the script would not work at all. When it suddenly stops working, and works again after a reboot, it is more likely that the reason for the error is another process, a resource/memory issue or perhaps multiple calls to the same process where that is not allowed.
You can use a program like Process Explorer to check if there are lingering processes from the script and kill these processes to find out if that solves the problem without having to reboot the computer.
Regards, Henk
3:33 pm
Hello Henk,
The issue has come back, it will most likely be fixed by restarting the server again, but I'd like to be able to completely fix it.
The redirects(-RedirectStandardError and -RedirectStandardOutput) come out empty.
I have taken the exitcode of Start-Process and it says "-1073741502" which is "DLL Initialization Failed".
There is a post saying it shouldn't even work in the first place: https://stackoverflow.com/a/30985036/22022398
Do you know what could make the Diafaan to start using a different user when launching Start-Process?
3:55 pm
Hello Henk,
There are try catches in both the C# script and Powershell that should have caught it, but it runs as if there are no problems.
I've added redirect of error and output and unfortunately/fortunately it just works now so i can't reproduce the error!
Thank you for your help, will be interesting to see what it outputs if the issue returns!
Hello Peter,
Without any logging output it is difficult to find out what the cause of the problem is. Your best option is to add code to the scripts to write as much information as possible to a log file. Things like debug error outputs or simply a text to indicate which lines in the scripts are executed.
For instance, if you are using the PowerShell 'Start-Process' command you can use the -RedirectStandardError and -RedirectStandardOutput to redirect errors and output text to a text file. It is good practice to use try-catch blocks in both scripts to catch as many errors as possible and write them to a text file when you want to debug the scripts.
Regards, Henk
3:25 pm
Hello Henk,
As far as I can tell our C# script runs as intended. That script runs a Powershell script.
This Powershell script has a line which runs an .exe with parameters, but this line doesn't do anything and doesn't produce any errors.
Above the line that runs the .exe is an output that tells me what it's going to call, when running that call directly in Powershell it works.
It also ran fine before.
The Diafraan service runs local system account.
I've tried restarting the service and hardware.
Yesterday it had problems finding a file "C:\Windows\TEMP\qxb3y0dc\qxb3y0dc.dll" but that hasn't shown today. I think that was just because I restarted the service.
Most Users Ever Online: 529
Currently Online:
6 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Member Stats:
Guest Posters: 680
Members: 0
Moderators: 0
Admins: 1
Forum Stats:
Groups: 2
Forums: 3
Topics: 1156
Posts: 3946
Newest Members:
, Henk HelmantelAdministrators: Henk Helmantel: 1511