0

I am working with a log analytics tool called Splunk, which executes a Powershell script and stores the output.

The script execution takes pretty long time and the output is around 100MB+ when the script completes the execution.

When I check the log of the script, I found out that the execution was paused and continued after around an hour!

After looking at the question about QuickEdit mode of the Powershell console metioned here, There are 2 possible reasons why this can happen:

  1. If the QuickEdit mode of the Powershell console is On, and if there are any selected words or area in terminal. But, this is not the case, as the Powershell is invoked as a background process

  2. If the stdout throughput is too much than the host console can handle. Possible reason as the output of the script is very large as mentioned.

Note: there is no sleep or stdin expected in the powershell script as it is meant for collecting performance metrics.

What is the exact reason of the hang of the process in this case, (from 2 mentioned about or any other) and how can I prevent it?

Jay Joshi
  • 1,402
  • 1
  • 13
  • 32
  • What does the script look like that you're generating 100+ MEGABYTES of data? – Maximilian Burszley Jun 26 '18 at 13:43
  • It fetches performance data of all the counters of all the machines configured in a SCOM group. – Jay Joshi Jun 26 '18 at 13:53
  • Ouch. Personally, I would consider spawning one background job per machine then putting the data all together at the end. – EBGreen Jun 26 '18 at 14:24
  • Thanks for the suggestion @EBGreen but that is how exactly SCOM works. It installs an agent at every machine which collects the data and sends to a server. I am just trying to store that received data into a safe - searchable location. – Jay Joshi Jun 26 '18 at 16:11
  • Looks like we need code. From your description alone I thought you were doing something completely different. – EBGreen Jun 26 '18 at 16:43
  • I would not be able to provide whole code as it is a project. Please share your concerns that you have with the code, I will provide the necessary info. Apart from this, I think the issue is with Powershell as there are many cases mentioned. e.g. : 1) https://serverfault.com/questions/204150/sometimes-powershell-stops-sending-output-until-i-press-enter-why 2) https://stackoverflow.com/questions/4453692/windows-console-application-getting-stuck-needs-key-press?noredirect=1&lq=1 – Jay Joshi Jun 26 '18 at 16:58
  • Sorry, without knowing what you are doing, I don't know what concerns to express. Perhaps someone else's crystal ball works better than mine. – EBGreen Jun 26 '18 at 17:46

0 Answers0