Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to path is denied #7

Open
nlvw opened this issue Feb 29, 2016 · 4 comments
Open

Access to path is denied #7

nlvw opened this issue Feb 29, 2016 · 4 comments

Comments

@nlvw
Copy link

nlvw commented Feb 29, 2016

I'm trying to compress multiple folders into separate zip files however I keep getting "Access to path is denied". if I run 7za.exe by itself it can zip the folders just fine.

My Script:

$folders = Get-ChildItem -Exclude ".mig",".zip","_Easy File Transfer (migwiz)"
$env:Path = $env:Path + ";K:\TechStuff\Tech_Software\7za"

foreach($folder in $folders) {

Compress-7Zip -Path $folder.Name -Format Zip -CompressionLevel None -ArchiveFileName ($folder.Name + ".zip")

}

Error:

Compress-7Zip : Access to the path 'K:\Profile Backups\spatrico' is denied.
At line:6 char:5

  • Compress-7Zip -Path $folder.Name -Format Zip -CompressionLevel No ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (SevenZip4PowerS...+CompressWorker:CompressWorker) [Compress-7Zip], UnauthorizedAccessException
    • FullyQualifiedErrorId : err01,SevenZip4PowerShell.Compress7Zip
@nlvw
Copy link
Author

nlvw commented Feb 29, 2016

So I dug into this a little more and found that for whatever reason (I have no idea why) Compress-7Zip will not working over Powershell Remoting. Using the same credentials the script will fail if run remotely and work if run from remote desktop.

@thoemmi
Copy link
Owner

thoemmi commented Feb 29, 2016

I've never used PowerShell Remoting before. However, as far as I understand it, the module is copied to the remote machine automatically. I guess that the remoting mechanism doesn't copy the required native DLLs 7z.dll and 7z64.dll, and the 7Zip4PowerShell can't find them on the remote machine. Can you verify that?

@nlvw
Copy link
Author

nlvw commented Feb 29, 2016

While in the remote session I did a "install-module" and pulled the module down to the remote machine from the powershell gallery. Also for reference i've always had to install-modules manually on the remote machine before they are usable for remoting.

@wehnertb
Copy link

wehnertb commented Sep 7, 2020

I just installed the 1.13 module today, locally in Powershell 5.1 on Windows 10. I tried to 7zip files in a directory I created and had a few pdf files in. I was running Powershell as Administrator. Whenever I try to compress anything, I get this message:

Compress-7Zip : Access to the path
'C:\WINDOWS\system32\config\systemprofile\AppData\Local\Microsoft\Windows\INetCache\Content.IE5' is denied.

Why this directory is being used instead of %TEMP%, I'm not certain. This directory doesn't even exist.

My command line was this:

Compress-7Zip -Path . -Filter *.pdf -ArchiveFileName .\stuff.7z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants