So I am trying to use invoke-command to install a chocolatey package who is just a 7z command to extract the archive from a server and unzip to the C: drive. Unfortunately, I'm having powershell access denied popped up and I don't know why.
1- My executionpolicy is unrestricted 2- I have set my computer to allow powershell remoting
Here is my code:
$Computers = Get-Content -Path "E:\DeployWin\scripts\test-chocolatey\vm.txt"
$Cred = Get-Credential $env:USERNAME
Foreach ($Computer in $Computers)
{
$Computer
Invoke-Command -ComputerName $Computer -Credential $Cred -ScriptBlock {choco install ue_4.24_test -my -t=0 --force}
}
I am greeted by the error:
Progress: Downloading ue_4.24_test 1.0... 51%
Progress: Downloading ue_4.24_test 1.0... 100%
ue_4.24_test v1.0 (forced)
ue_4.24_test package files install completed. Performing other installation steps.
7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21
Scanning the drive for archives:
System.Management.Automation.RemoteException
ERROR: Access denied‚.
\\servername\share\nameofthezip.zip
In my chocolatey package, I am using:
7z e "\servername\share\nameofthezip.zip" -o"D:\"
If I do this command on the target computer directly in powershell, it works without a problem... is this a double hopping problem? Anyone has an idea?