UNC Path not recognised when executing post deploy script

I’m trying to access and list the directory under the UNC path through post deploy script. Say \\Directory

I’m using Get-ChildItem $path where $path is an explicitly defined octopus variable.
It throws
Get-ChildItem : Cannot find path ‘\\Directory’ because it does not exist.

However the command works perfectly fine in PowerShell window.
I also have tried using $path = Microsoft.PowerShell.Core\FileSystem::\\Directory which also throws exactly the same error.

Is there anything I missed?

Tentacle version

Hi Yudi,

Thanks for getting in touch! It appears that you are missing a \ in your path.
Your variable will need to be set to \\\Directory or, if it already is, then its counting as an escape so please set it to \\\\Directory

Let me know if that resolves this issue!

HI Vanessa,

Thank you for your reply. The variable seems to be correct without needing to escape it.
In the end, we found out that Local System user doesn’t have enough permission to access UNC path.
We created a dedicated user with enough permission to access Tentacle directory and shared directory. That solves our problem.