Powershell - can't copy and compress from shared folder

137 Views Asked by At

I want to achrive content of shared folder, but it's not working with this command: Copy-Item -Path $source -Force -PassThru | Get-ChildItem | Compress-Archive -DestinationPath $destination

If $source = C:\MyNormalFolder than it's working, but if I use
C:\MySharedFolder or \\MyPC\MySharedFolder, it doesn't work. I get no error, just see empty destination folder.

In that folder are files used by other processes, that's why I can't use just Compress-Archive. Do you have any idea how to solve it?

0

There are 0 best solutions below