Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy can't I unzip in PowerShell on a TeamCity Agent?
    text
    copied!<p>I have a script that unzips an MVC package, minifies all the CSS and js files, and rezips it. It works perfectly on my machine and on the CI server as an admin or the TeamCity account. When TeamCity pulls it down and runs it, the script gives all the output expected, doesn't report an error, but it will never unzip the file.</p> <pre><code>write-host "creating shell object" $shell_app=new-object -com shell.application write-host "creating zip file" $zip_file = $shell_app.namespace("C:\temp\PokerLeagueWebSite.zip") write-host "setting folder to unzip to" $destination = $shell_app.namespace("C:\temp\zy98") write-host "about to copy files from zip" $destination.Copyhere($zip_file.items(), 0x4) write-host "finished" </code></pre> <p>Here is the output from TeamCity:</p> <pre><code>[23:01:03]: Step 5/5: test ps1 file (Powershell) [23:01:03]: [Step 5/5] Starting: C:\Windows\system32\cmd.exe /c C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -File C:\TeamCity\buildAgent\work\71e78d4c543e0594\Tools\test.ps1 &amp;&amp; exit /b %ERRORLEVEL% [23:01:03]: [Step 5/5] in directory: C:\TeamCity\buildAgent\work\71e78d4c543e0594 [23:01:03]: [Step 5/5] creating shell object [23:01:03]: [Step 5/5] creating zip file [23:01:03]: [Step 5/5] setting folder to unzip to [23:01:03]: [Step 5/5] about to copy files from zip [23:01:03]: [Step 5/5] finished [23:01:03]: [Step 5/5] Process exited with code 0 [23:01:03]: Publishing internal artifacts [23:01:03]: [Publishing internal artifacts] Sending build.finish.properties.gz file [23:01:03]: Build finished </code></pre> <p>If I run the exact command on the server on the TeamCity account it works correctly:</p> <pre><code>C:\Windows\system32\cmd.exe /c C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -File C:\TeamCity\buildAgent\work\71e78d4c543e0594\Tools\test.ps1 &amp;&amp; exit /b %ERRORLEVEL% </code></pre> <p>I can only think it is either something TeamCity is doing or something related to the fact it is running as a service, but I am stumped and can't figure this one out.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload