Forum Discussion
Deploying PS Script as Application Doesn't Work
- Apr 24, 2025
Your problem is that you are copying a file from a network share. This is because the script will run as local system account. As such you need to test your script as local system. This blog will show you how to do that. How to Access the Local System Account - Recast Software
You can solve this but including the license file with the script/setup. That is the simplest solution.
Yeah it's a pretty basic PS script.
did you test the script as the local system account? Are any of the paths Unc?
- dkingsb4Apr 28, 2025Copper Contributor
So when I was testing this initially I tested using the signed in user account at least just to make sure the syntax was correct, which it was. Knowing that MECM was using the SYSTEM account, I made the assumption that the issue I was having with doing this through MECM was just that - so I never tested directly with the SYSTEM account. However, using your instructions, I did find that this did indeed fail. Once I gave "All Domain Computers" read/execute on the source location share, the SYSTEM account was successful in copying over the files. I was then able to make this work directly within MECM using the script.
I also made an application, one to install the software I'm looking to install, and a second one to invoke the script to copy the files. This works, but I did find that it seems to fail initially because the script tries to run at the same time as the software install (therefore the target directories don't exist). This is despite me specifying that the software installation is to be a prerequisite. A second run at the script install after the software is in place is successful.
I'm sure there's a better way of accomplishing this as well. I'll have to keep tinkering with it to get it exactly the way I want it, but this works for now.