I’m trying to execute Powershell script that copies one file from local drive to network location
$src = C:\file.txt
$dst = \10.0.0.1\Share\file.txt
Copy-Item $src -Destination $dst
but it fails with ‘Access denied’ error
When i executed this script localy from Powershell all went good
Share folder permisions are set to All/FullControl for both Share and NTFS security options.
I think the problem may be in SYSTEM user from witch Tentacle executing Powershell script
Can you help me with this?
Also tried to mount PSDrive and failed again
New-PSDrive : Drive root “\10.0.0.1\Share” does not exi
st or it’s not a folder.
- New-PSDrive <<<< -Name X -PSProvider FileSystem -Root \10.0.0.1\Share
- CategoryInfo : ReadError: (X:PSDriveInfo) [New-PSDrive], IOExce
- FullyQualifiedErrorId : DriveRootError,Microsoft.PowerShell.Commands.New
Thanks for getting in touch! The service user that Octopus runs under would not have the permissions to perform the tasks you are after.
You can change the user that tentacle runs under for these scenarios:
Let me know how that goes!
hello! thanks for the advice now copy-item works fine, but after i changed the RunAs user the script stucks at this step:
echo “Unzip archive…”
$shell_app = New-Object -com shell.application
$s_zip = $shell_app.namespace($zip)
$s_unzip = $shell_app.namespace($unzip)
when i logon to machine with creds thst i set as RunAs for Tentacle and run this script localy from Powershell it works fine
resolved this issue by using 7zip CLI to unzip archive