Powershell running under a service hangs on *.zip CopyHere Powershell running under a service hangs on *.zip CopyHere powershell powershell

Powershell running under a service hangs on *.zip CopyHere


If it's still actual, I managed to fix this with having CopyHere params equal 1564.

So in my case extract zip function looks like:

    function Expand-ZIPFile{    param(    $file, $destination    )    $shell = new-object -com shell.application    $zip = $shell.NameSpace($file)    foreach($item in $zip.items())    {    $shell.Namespace($destination).copyhere($item,1564)    "$($item.path) extracted"    }

1564 description can be found here - http://msdn.microsoft.com/en-us/library/windows/desktop/bb787866(v=vs.85).aspx:

(4) Do not display a progress dialog box.
(8) Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists.
(16) Respond with "Yes to All" for any dialog box that is displayed.
(512) Do not confirm the creation of a new directory if the operation requires one to be created.
(1024) Do not display a user interface if an error occurs.


If this is running on Vista or Windows 7, popping up UI from a service isn't going to be seen by the end user as you suspected. See this paper on Session 0 Isolation. However, does the progress dialog require user input? If not, I wouldn't think that would cause the service to hang. I would look for an option to disable the progress display. If you can't find that, then try switching to another ZIP extractor. PSCX 1.2 comes with an Expand-Archive cmdlet. I'm sure there are also others available.


Looking at the documentation for PowerShell, it looks like the -NonInteractive option may help here