PowerShell Community Extensions not Recognized by TeamCity PowerShell Runner -


when teamcity powershell runner runs .ps1 file doesn't recognize write-zip command, part of powershell community extensions.

i can run same command manually on build server , works fine. i've verified both teamcity , running x64 version of powershell.exe , both running same user.

[17:21:22][step 5/5] packaging www.zip [17:21:45][step 5/5] write-zip : term 'write-zip' not recognized name of cmdlet,  [17:21:45][step 5/5] function, script file, or operable program. check spelling of name, or  [17:21:45][step 5/5] if path included, verify path correct , try again. [17:21:45][step 5/5] @  [17:21:45][step 5/5] c:\teamcity\buildagent\work\e19b1309c030c7e2\build\powershell\package.ps1:20  [17:21:45][step 5/5] char:1 [17:21:45][step 5/5] + write-zip -inputobject $items -outputpath .\www.zip [17:21:45][step 5/5] + ~~~~~~~~~ [17:21:45][step 5/5]     + categoryinfo          : objectnotfound: (write-zip:string) [], commandno  [17:21:45][step 5/5]    tfoundexception [17:21:45][step 5/5]     + fullyqualifiederrorid : commandnotfoundexception [17:21:45][step 5/5]  

i think may related powershell being run different environment don't understand yet.

i found in teamcity build logs script being run this:

 c:\windows\sysnative\cmd.exe /c c:\windows\system32\windowspowershell\v1.0\powershell.exe -noninteractive -executionpolicy bypass -file c:\teamcity\buildagent\work\e19b1309c030c7e2\build\powershell\package.ps1 -workingdirectory c:\teamcity\buildagent\work\e19b1309c030c7e 

notice powershell being run c:\windows\sysnative\cmd.exe

however, on build server, don't see directory or version of cmd.exe, , if try run same command powershell or command prompt, says can't find c:\windows\sysnative\cmd.exe

does know how teamcity runs powershell?

update

i tried running powershell script using command line runner , calling powershell.exe -file command teamcity do.

i had taskmanager running , saw cmd.exe process ran c:\windows\syswow64\cmd.exe

i got exact same error printed above, write-zip not recognized. however, if run same command in ...\syswow64\cmd.exe manually, works.

once again, both running same user on same machine, according taskmanager

do import pscx module in script? powershell v3 cache module info after have done once don't need import again. if teamcity running 64-bit console , run 32-bit console, 64-bit console wouldn't have pscx commands in command cache. anyway, practice have scripts explicitly require modules depends upon e.g.

#requires -modules pscx 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -