When my Powershell scripts have stopped working in the past, it’s usually been because some policy was pushed out without regard to what might break. Just speculating that it’s because you can do a lot of harm with Powershell so they limit being able to run it. I’ve been able to get around those restriction by compiling the scripts into executables (.exe files). They aren’t truly compiled but rather wrapped in an executable that runs the script, but it doesn’t seem to matter to the server.
You can do that using PS2EXE freeware. Where I worked, they got smart enough to buy me a license for Sapien Powershell Studio which can do the same thing and gives you a lot of options about how you want it to execute. It’ll cost money, but they used to have a free community edition of it that you might be able to find.
Could be worth a try just to keep from having to rewrite a bunch of stuff.