Powershell running under a service hangs on *.zip CopyHere

Question:

I’m running a Windows Service (Hudson) which in turn spawns a PowerShell process to run my custom PowerShell commands. Part of my script is to unzip a file using CopyHere. When I run this script locally, I see a progress dialog pop up as the files are extracted and copied. However, when this runs under the service, it hangs at the point where a dialog would otherwise appear.

Here’s the unzip portion of my script.

I suspect that because its running under a service process which is headless (no interaction with the desktop), its somehow stuck trying to display a dialog.

Is there a way around this?

Answer:

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:

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.

Source:

Powershell running under a service hangs on *.zip CopyHere by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply