我有几个步骤可以解决这个问题,但是我不知道该怎么办。我的最终目标是检查“ app.exe”文件的版本。当我在服务器上手动运行它时,两个脚本版本都可以工作。但是当章鱼运行时,两个版本都会失败,并出现不同的错误
版本1:
$file = "C:\Octopus\Applications\AppStartUp\38.2.19.0\app.exe"
$fileVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($file).FileVersion
我得到了错误:
return [System.Diagnostics.FileVersionInfo]::GetVersionInfo <<<< ($file). FileVersion
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : DotNetMethodException
版本2:
$file = "C:\Octopus\Applications\AppStartUp\38.2.19.0\app.exe"
(Get-Command "$file").FileVersionInfo.Fileversion
错误信息
Export-ModuleMember : The Export-ModuleMember cmdlet can only be called from in side a module. At C:\Octopus\Applications\CSIS_DEV\ESG.CSIS.StartUp\38.2.19.0\deployment\clickOnceLib.ps1:35 char:20
+ Export-ModuleMember <<<< -function * -alias *
+ CategoryInfo : PermissionDenied: (:) [Export-ModuleMember], InvalidOperationException
+ FullyQualifiedErrorId : Modules_CanOnlyExecuteExportModuleMemberInsideAModule,Microsoft.PowerShell.Commands.ExportModuleMemberCommand
Get-Command : The term 'C:\Octopus\Applications\CSIS_DEV\ESG.CSIS.StartUp\38.2.19.0\ESG.CSIS.StartUp.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Octopus\Applications\CSIS_DEV\ESG.CSIS.StartUp\38.2.19.0\deployment\clickOnceLib.ps1:32 char:24
+ return (Get-Command <<<< "$file").FileVersionInfo.Fileversion
+ CategoryInfo : ObjectNotFound: (C:\Octopus\Appl...SIS.StartUp.exe:String) [Get-Command], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
这些消息的任何Insite以及为什么仅在章鱼中运行时才会发生。
您的脚本似乎无法访问该文件,或者该文件不存在。检查并确保C:\Octopus\Applications\CSIS_DEV\ESG.CSIS.StartUp\38.2.19.0\ESG.CSIS.StartUp.exe
触手在其下运行(使用Windows有效权限)并可供用户访问。
还要确保在脚本运行时就已经存在,您还没有提到这是一个单独的步骤,PreDeploy.ps1,Deploy.ps1或PostDeploy.ps1脚本
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句