I have a problem similar to: http://help.octopusdeploy.com/discussions/problems/367-powershell-scripts-and-import-module
In my PreDeploy.ps1 script I am importing a custom module from a non-standard location. The deployment fails with:
2012-10-03 21:31:44 DEBUG Script output:2012-10-03 21:31:44 DEBUG ERROR: Import-Module : The specified module ‘Deployment’ was not loaded because no valid module file was found in any module directory.ERROR: At C:\Octopus\Applications\Staging[ProjectName]\1.0.54.24_2\PreDeploy.ps1:1 char:14ERROR: + Import-Module <<<< DeploymentERROR: + CategoryInfo : ResourceUnavailable: (Deployment:String) [Import-Module], FileNotFoundExceptionERROR: + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
The PSModulePath enviroment variable is set at the machine level to include the path the module. When I run the tentacle from the command line and excute the script it works just fine. When I change the tentacle to run under an administrative account it also works. This seems to only be a problem when running under the local system account. This is a Windows 2003 server. Do you know of any other work arounds, besides running the tentacle as an administrator?
Thanks.