Hi,
I’m trying to run a simple script which run on one server but creates a file under a share location. When I run it remotely the script works fine. I’m getting permission denied in Octopus.
New-Item -ItemType file “\sharelocation\sharefolder\test.txt”
$cred = get-credential
Invoke-Command -ComputerName “localhost” -Credential “$cred” -ScriptBlock { New-Item -ItemType file “\sharelocation\sharefolder\test.txt” }
This would work but I need a way to use Octopus Variable for the get-credential property.
Or is it a case of obtaining access to that share for my Octopus account? I take it that’s the account running powershell or is it the local one which would be this according to the logs CurrentUser: NT AUTHORITY\SYSTEM