I am trying to use invoke-command to install some chocolatey packages.
When the files are embedded in the chocolatey package, it works without problems. However, when I try to specify a share on a remote server and even opening it in read/write for everyone, I get an access denied when chocolatey try to access it.
Ironically, if I do the same command on the target computer and not using invoke-command, it works like a charm!
Is there something I am not getting?
The powershell script is standard:
$Computers = Get-Content -Path "C:\Users\ladmin\Desktop\testpowershell\vm3.txt"
$Cred = Get-Credential $env:USERNAME
foreach ($Computer in $Computers)
{
$Computer
Invoke-Command -ComputerName $Computer -Credential $Cred -ScriptBlock {choco install ue-4.24-zip -my -t=0}
}
And here is my chocoinstall script:
$ErrorActionPreference = 'Stop'; # stop on all errors
$fileLocation = '\\testserver\test\UE_4.24.zip'
Install-ChocolateyZipPackage $packageName $fileLocation -UnzipLocation "c:\test"
I really don't get what I am doing wrong.....