PSU doesn't detect file changes

We are seeing problems with the web editor not detecting change to the files outside of the site using VS Code or PS ISE. This is also true for the configuration files and it also seems to be the same problem with the auto deploy function.

Our PSU service is running under a managed service account (gMSA) and it have got the permissions to read and edit the folders where the script and dashboard files are located. It is also a member of the local policy ‘Back up files and directories’ which should give the necessary permissions to use the FileSystemWatcher. We have also tried giving it full administrator permission on the server which also doesn’t work.

So i decided to test the FileSystemWatcher using the managed service account with the asynchonous script found at Monitoring Folders for File Changes - powershell.one to see if it worked.

I started powershell as the managed service account using PSExec and then ran the FileSystemWatcher script.
PSExec64.exe -i -u domain\gMSA$ -p ~ powershell.exe

Then editing some file and instantly i see the script detect that there was change to the files.

This leads me to believe there is a issue in PSU that needs to be fixed.
I haven’t got a GIT account, so i cannot post this as an issue there.

I made a similar post regarding the auto deploy feature last year which also have information on how we run PSU.
Auto Deploy feature doesn’t work - PowerShell Universal - Ironman Software Forums

Product: PowerShell Universal
Version: 3.7.6

You can determine if PSU is picking up the changes via the internal FileSystemWatcher by enabling debug logging and looking for this message:

_logger.LogDebug($"File {fileName} changed. Syncing...");

I’d recommend turning that on to make sure we are seeing the change. From there we can determine why the file wouldn’t be reloading.

Hi Adam

I finally had time to test this.

I enabled debug logging by going to Settings → General → Diagnostics and setting Log Level to Debug.

For automation script i see no file change detected in the log but for some reason now i see it working for Dashboard and configuration files but when changing the Dashboard files the the dashboard doesn’t restart.

Our Automation scripts folder is configured using the ScriptBaseFolder of the settings.ps1 file and is located in C:\PSU\Automation.

The problems we have now are:

  • Dashboard file reloads but auto deploy doesn’t restart the dashboard
  • Automation script changes is not detected

Also if a user is in the web editor for a Dashboard (or configuration files) and a file is updated outside of PSU, there should be a popup telling them that there has been a change to the file and if they want to keep the existing one or overwrite.

Hi @adam

Do you have any clue as to why this isn’t working?

I don’t have an update yet but we are looking into the file system changes. We are seeing other files (e.g. licenses.ps1) fail to reload when written to disk.

Thanks for the update Adam.