When you get an OK from a Automate command as a return, then most likely something went south during execution and instead of returning a error it "crashed" and Automate returns a OK...
Otherwise you would get either a POSH error returned or a "True or False" as the last POSH command on the script is to test the file that was copied to the share. True if file exists and false if it does not. OK does not have any relevance in the code, we do not return any "OK" as part of that script.
So...
Now we need to test the script first hand to make sure POSH does not explode when the script is executed.
On that agent, remote into desktop and open as an "run as Administrator" the PowerShell ISE and copy the script code as you have it now into the ISE.
Execute it and see what is returned. I am sure it either will result in an error or it will complete as expected.
If it completes as expected then the share is good and working as expected, we have an agent script to agent POSH issue. We should then try some basic POSH commands on the agent through the plugin to see if there is more with POSH inside the agent. The POSH engine that the script uses may not be the same that the ISE uses and more testing of agent POSH may show other issues.
If it fails then the POSH should revile the error and the line in the code it fails at. We can then see why it does not like what it sees.
Just a side note, Since this seems to be a uncommon issue as we have many MSPs using the Habitat App manager and the caching it produces without the issue we are seeing here. Typically it shouldn't be this hard to get rolling if your Network Share permissions are good. Some general and simple thing to try to do to narrow down where your issue lies.
To rule out agent specific issues:
- How many clients have you deployed caching to thus far?
- Are all the locations and clients having this issue or is this a one off client/location?
- Have we tried a different agent?
- Have we tried an agent that has POSH 5.1 installed currently?