当前位置: 首页 > 知识库问答 >
问题:

使用powershell的Teamcity和msdeploy

吴飞语
2023-03-14

开发了一个powershell脚本,它接受buncha参数,创建MSDeploy字符串并执行它。我已经测试了这个powershell命令:

  1. 它在我的本地盒上工作(将web应用程序从我的本地盒安装到远程IIS服务器)
  2. 它在TeamCity box上工作(将web应用程序从team City的文件夹结构安装到远程iis服务器)
$msDeploy = 'C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe'
$sourcePackage = $args[0]
$paramFile = $args[1]
$iisAppPath = $args[2]
$servername = $args[3]
$usreName = $args[4]
$password = $args[5]
$includeAcls = $args[6]

function UpdateParamFile($paramXMLFile, $applicationPath)
{
    $doc = New-Object System.Xml.XmlDocument
    $doc.Load($paramXMLFile)

    #IIS Application Path (this is where the code will be deployed - it has to exist in target IIS):
    $appPath = $doc.SelectSingleNode("//parameters//setParameter[@name = 'IIS Web Application Name']")
    $appPath.value = $applicationPath

    #Connection Strings:

    #KDB Connection string:

    #Save
    $doc.Save($paramXMLFile)

    #[xml] $xmlPars = Get-Content $paramXMLFile
    #$xmlPars.parameters.setParameter | Where-Object { $_.name -eq 'IIS Web Application Name' } | select value
}

UpdateParamFile $paramFile $iisAppPath
$arguments = "-source:package=$sourcePackage", "-dest:auto,computerName=`"$servername`",userName=`"$usreName`",password=`"$password`",includeAcls=`"$includeAcls`"", "-setParamFile:$paramFile", '-verb:sync', '-disableLink:AppPoolExtension', '-disableLink:CertificateExtension', '-disableLink:ContentExtension'
&$msDeploy $arguments

Teamcity调用上述脚本文件:

C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell.exe-noninteractive-executionPolicy旁路-file C:\teamcity\buildagent\work\253e6183c0596123\debug\pmrswebsite\deployweb.ps1 debug\pmrswebsite\web.csproj.zip“debug\pmrswebsite\web.csproj.setparamers.xml”^^^IIS_APP_NAME^^^^^^^ServerName^^^^^^^^用户

共有1个答案

龙高超
2023-03-14
ERROR_USER_NOT_ADMIN

Diagnosis - This happens if you try to connect to the Remote Agent Service but 
  have not provided appropriate administrator credentials.

Resolution - The Remote Agent Service accepts either built-in Administrator or 
  Domain Administrator credentials. If you have a non-domain setup and want to 
  use account other that built-in administrator, please do following:

  1. Create a separate user group MSDepSvcUsers on remote computer.
  2. Create an local account A on both local & remote computer.
  3. Add A to MSDepSvcUsers on remote computer.
  4. Use account A to publish, this will allow you to publish without needing to 
     use built-in admin account.

经由

 类似资料:
  • TeamCity 是一个通用的CI/CD解决方案,可以为各种工作流程和开发实践提供最大的灵活性。TeamCity提供一系列特性可以让团队快速实现持续继承:IDE工具集成、各种消息通知、各种报表、项目的管理、分布式的编译等等,所有的这些,都是 让你的团队快速享有持续继承带来的效率提升、高质量的软件保障。

  • 本文初衷 让大家了解持续集成(CI),以及入门了解 JetBrains 家的 TeamCity 的一些简单实用。 TeamCity 的一些复杂使用我暂时也不会,一样也是要看文档的,所以不管怎样你都要养成看官网文档的习惯。 TeamCity 和 Jenkins、Hudson 其实是非常一样的,基本流程都是差不多的,所以如果你会其他的几个 CI 工具的话,学习起来很快。 Docker 已经开始在引入到

  • ...还有一个很简单的测试... 如果我在IntelliJ中运行这个,测试就会运行并失败。 如果我提交这个项目并将其推送到github,TeamCity会看到变化并开始构建。生成会很快失败,出现以下错误:

  • 我正在尝试使用Powershell和Selenium在chrome浏览器中自动单击。到目前为止,我已经成功地单击了下面的html文件示例主体中的元素。 HTML Powershell 使用上面的脚本将单击select元素中的第三个选项(在本例中为“Mercedes”)。 然而,我正在努力操纵阴影根中的元素,我似乎无法访问其中的任何元素,更糟糕的是,我要单击的元素位于子阴影根中,如下图所示: 上述图

  • 我正在使用springboot和rest-assured编写集成测试,并使用SpringApplicationConfiguration加载配置。 这是测试类注释的样子: 现在是我真正的问题。当我使用maven在teamcity中运行测试类时,在运行集成测试之前,我不需要配置一些东西来运行springboot服务器吗? 我是springboot的新手,所以这个问题可能非常新手,但请给我指出正确的道

  • 问题内容: 我正在使用Windows XP。 我正在尝试在Powershell中使用Python。在我的计算机上,我同时安装了Python 3.3和2.7。我正在尝试运行2.7,但是每当我在powershell中键入“ python”时,它就会打开3.3。 如何选择要运行的Python版本? 问题答案: 在powershell中,输入以下内容: 然后尝试使用命令“ py”。它应该启动Python