1

I am trying to extract some password protected file using powershell

(new-object -com shell.application).namespace("C:\Downloads").CopyHere((new-object -com shell.application).namespace("C:\Downloads\pathzip.zip").Items(),16)

I get an error Error 0x80004005 unspecified error.

This error only happens when I try to unzip files that are password protected. I've looked online and this indeed seem to be an "Access denied" error.

I'd like that powershell pops a modal dialog and asks me to type password in, instead of just throwing an error and giving up. Can this be done using powershell?

sanjihan
  • 5,592
  • 11
  • 54
  • 119
  • What's `"${downloadFolder}"`? – Tomalak Oct 06 '18 at 20:19
  • 1
    a variable. Let me change it so it wont confuse – sanjihan Oct 06 '18 at 20:25
  • 1
    Relevant: https://stackoverflow.com/questions/27768303/how-to-unzip-a-file-in-powershell - You might want to try an alternative approach for handling ZIP files. – Tomalak Oct 06 '18 at 20:31
  • Installing additional software? The .NET framework does not need to be installed. – Tomalak Oct 06 '18 at 20:34
  • ...and as one of the answers in the thread notes, as of PowerShell 5 there even is a built-in cmdlet for ZIP files. – Tomalak Oct 06 '18 at 20:37
  • The `Shell.Application` object can't handle password-protected zip archives, neither can the other approaches suggested in the answers to the linked question. According to an answer to [this question](https://stackoverflow.com/q/13160490/1630171) the [DotNetZip](https://www.nuget.org/packages/DotNetZip) library supports extracting password-protected archives. 7-zip (and other commandline packers) also can handle password-protected archives. – Ansgar Wiechers Oct 06 '18 at 22:00
  • I ended up using 7-zip – sanjihan Oct 07 '18 at 17:12

0 Answers0