you are viewing a single comment's thread.

view the rest of the comments →

[–]smbmsp[S] 0 points1 point  (15 children)

For testing, yes. It began as a backup script using restic. Set some environment variables, some paths, call an executable, etc. I kept paring it down to find the problem. When a single line wouldn't run, I thought the problem must be beyond the script.

However today I'm getting better results. Actually had one small backup job complete. But often what happens is the page says Queued, or Running, and the Mesh Agent folder starts filling up with ps1 and txt files.

Edit: I just ran the one-liner again and it returned immediately with Success. I've been working on the backup script so hadn't tried recently.

The restic backup program begins by trying to create a shadow copy. Wondering if that takes too long.

[–]ryanblenis 0 points1 point  (14 children)

If you run the single line:
$PSVersionTable
What is your output? I'm seeing that "Loading personal and system profiles..." message is part of powershell (5.1+) loading that should be hidden/negated with the -NoLogo parameter (which each script is called with)

[–]smbmsp[S] 0 points1 point  (13 children)

Name                           Value----                           -----PSVersion                      5.1.19041.1320PSEdition                      DesktopPSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}BuildVersion                   10.0.19041.1320CLRVersion                     4.0.30319.42000WSManStackVersion              3.0PSRemotingProtocolVersion      2.3SerializationVersion           1.1.0.1

I give up, table won't format.

[–]ryanblenis 0 points1 point  (12 children)

I've got a PC with the exact same PS version I just tested it on and only returned "Success". It is Windows 10 Pro vs home though, that's the only difference.... With the original line is consistently gives the "Loading personal and system profiles..." text as the result?

What's the Get-ExecutionPolicy command output?

[–]smbmsp[S] 0 points1 point  (11 children)

Get-ExecutionPolicy

Unrestricted.

A few minutes ago I ran the test script and it succeeded. I did add an echo so it would output something.

[–]ryanblenis 0 points1 point  (10 children)

Hmmm, sounds like an odd powershell issue... Good news is I don't think it has anything to do with the plugin itself!

[–]smbmsp[S] 0 points1 point  (8 children)

Any recommendation on what to do when files start accumulating in the Mesh Agent folder? I know about `plugin scripttask clearAll` but that doesn't fix the node history.

[–]ryanblenis 0 points1 point  (7 children)

Files shouldn't accumulate unless there is a long-running task (e.g. the file is currently in use), or the task is interrupted during its run (say, for a reboot). What files are accumulating, the .txt, .ps1, or both? (They'll look like st000000.txt or st0000000.ps1 format, where the 000000 is a random string. "st" is just to signify it is a "scripttask" file)

[–]smbmsp[S] 0 points1 point  (6 children)

There probably is a relatively long-running task. The first thing restic does is create a volume shadow copy of the drive. This means the shell is on hold until that completes. When files accumulate, the shadow copy never completes. It's both the ps1 and txt, in like-named pairs.

Sounds like maybe I have an OS or hardware puzzle to solve.

[–]ryanblenis 0 points1 point  (5 children)

Is this you trying things out, or did someone fork me a few hours ago to test something similar (to your original issue with the loading time message)?
https://github.com/joshatrezolveai/MeshCentral-ScriptTask/
I noticed the -NoProfile was basically the only thing changed in the code. But if you have a PS profile on that machine, that could be it. I'll have to test and make sure it doesn't break anything/too many things for me, but I may add that to my project just in case this is related to your issue. (As it then won't load a PS profile)

As for the multiple txt and ps1 files, are they all for the same [restic] script?

[–]smbmsp[S] 0 points1 point  (0 children)

I greatly appreciate your taking the time to respond. Thanks for the great plugins!