使用Powershell作为部署脚本会出错:指定的可执行文件不是此OS平台的有效应用程序。 [英] Using Powershell as deployment script gives error: The specified executable is not a valid application for this OS platform.

查看:421
本文介绍了使用Powershell作为部署脚本会出错:指定的可执行文件不是此OS平台的有效应用程序。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用LabDefaultTemplate设置了实验室环境。

I have set up a Lab Environment using the LabDefaultTemplate.

我创建了一个Powershell脚本作为部署脚本。在我的实验室机器上运行部署脚本时,我收到以下错误"指定的可执行文件不是此OS平台的有效应用程序。"

I have created a Powershell script as a deployment script. When the Deployment Script are being run on my lab machine i recieve the following error "The specified executable is not a valid application for this OS platform."

无论是否重要使用空的ps1文件或包含我的部署脚本的文件。实验室服务器上的powershell执行策略设置为"Unrestricted"。

It doesn't matter if use a empty ps1 file or a file that contains my deployment script. The powershell executing policy on the Lab Server is set to "Unrestricted".

以下是日志文件的摘录。

Below is extract from the logfile.

运行部署脚本

初始属性值

MaximumAttemptsForNetUse = 0

ScriptDetails =虚拟机:  SharePoint 2010 AgentSpec:  Name = *,Tags = MachineName = SharePoint 2010,EnvironmentName = SharePoint 2010,TeamProject = Team Project 1,TeamProjectHostGroup = All Hosts FileName: 
\\testtfs2010bld1.MyDomain.local\drop\Build 全部wsp \建立所有wsp_20101128.7\Deploy.ps1参数:   WorkingDirectory:c:\ temp EnvironmentVariables:BuildLocation = \\testtfs2010bld1.MyDomain.local\drop \Build
all wsp\Build all wsp_20101128.7 InternalComputerName_Domain Controller = WIN-U80J27DQQQN ComputerName_SharePoint 2010 = VSLM- 232-d9d724c4-8069-4626-8ac5-94adc974b950.MyDomain.local InternalComputerName_SharePoint 2010 = WIN-92B3JTMC66T


SharedLocationForNetUse =
\\testtfs2010bld1.MyDomain.local \ drop \Build
所有wsp \建立所有wsp_20101128.7

ThrowOnError = True

Running Deployment Script
Initial Property Values
MaximumAttemptsForNetUse = 0
ScriptDetails = Virtual machine:  SharePoint 2010 AgentSpec:  Name=*, Tags=MachineName=SharePoint 2010,EnvironmentName=SharePoint 2010,TeamProject=Team Project 1,TeamProjectHostGroup=All Hosts FileName:  \\testtfs2010bld1.MyDomain.local\drop\Build all wsp\Build all wsp_20101128.7\Deploy.ps1 Arguments:   WorkingDirectory: c:\temp EnvironmentVariables: BuildLocation=\\testtfs2010bld1.MyDomain.local\drop\Build all wsp\Build all wsp_20101128.7 InternalComputerName_Domain Controller=WIN-U80J27DQQQN ComputerName_SharePoint 2010=VSLM-232-d9d724c4-8069-4626-8ac5-94adc974b950.MyDomain.local InternalComputerName_SharePoint 2010=WIN-92B3JTMC66T
SharedLocationForNetUse = \\testtfs2010bld1.MyDomain.local\drop\Build all wsp\Build all wsp_20101128.7
ThrowOnError = True

在虚拟机SharePoint 2010上运行脚本:

使用实验室服务帐户访问以下位置:MyDomain \\ \\ svcTFSlabservice,
\\testtfs2010bld1.MyDomain.local\ drop

\\testtfs2010bld1.MyDomain.local\drop \ Build 所有wsp \建立所有wsp_20101128.7 \ Disloy.ps1

Running Script on virtual machine SharePoint 2010:
Accessing the following location using the lab service account: MyDomain\svcTFSlabservice, \\testtfs2010bld1.MyDomain.local\drop.
\\testtfs2010bld1.MyDomain.local\drop\Build all wsp\Build all wsp_20101128.7\Deploy.ps1

 指定的可执行文件不是此OS平台的有效应用程序。

 The specified executable is not a valid application for this OS platform.

使用实验室服务帐户停止访问以下位置:MyDomain \ svcTFSlabservice,
\\testtfs2010bld1.MyDomain.local\ drop

Stopped accessing the following location using the lab service account: MyDomain\svcTFSlabservice, \\testtfs2010bld1.MyDomain.local\drop.

所有服务器都是x64,包括实验室服务器,TFS角色和开发环境。

All servers are x64 including lab servers, TFS roles and the dev environment.

任何想法如何解决这个问题?

Any idea how to troubleshoot this?

Tony

推荐答案

嗨Tony,

我认为这里的问题是调用ps1脚本不自动启动PS shell。您需要显式启动shell并在其中运行该文件。您可以通过调用

I think the issue here is that calling the ps1 script does not automatically launch the PS shell. You will need to explicitly launch the shell and run the file within it. You can invoke this script by calling

powershell.exe -file \\yourpath \ youry来调用此脚本.ps1

powershell.exe -file \\yourpath\your.ps1

这也是需要指定为部署脚本参数的内容。

which is what would need to be specified as your deployment script parameter as well.

谢谢

-Allen

 


这篇关于使用Powershell作为部署脚本会出错:指定的可执行文件不是此OS平台的有效应用程序。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆