首页 文章

适用于Windows Server 2012和SQL Server 2014

提问于
浏览
1

我实际上在superUser上发布了这个问题,但我认为它可能在错误的地方 . 我很抱歉 .

我一直在使用ansible和WinRM来管理Windows服务器,并且使用它来运行基本命令略有成功 .

但是,当我尝试从powershell脚本中运行exe文件时,它会失败 .

当我直接从Windows运行时,它运行完全没有任何错误 . 它抛出的唯一错误是一个Access Denied错误,它会链接到权限,但是作为管理员,它应该具有完全权限吗?

我尝试运行的powershell脚本是:

Write-Host "Installing SQL Server"
C:\software-downloads\SQL\setup.exe /ConfigurationFile=C:\software-downloads\ConfigurationFile.ini

Ansible抛出的错误是:

The following error occurred:
There was an error generating the XML document.
Error result: -2068774911
Result facility code: 1201
Result error code: 1
Please review the summary.txt log for further details

并查看它显示的摘要日志文件:

Overall summary:
  Final result:                  Failed: see details below
  Exit code (Decimal):           -2068774911
  Exit facility code:            1201
  Exit error code:               1
  Exit message:                  There was an error generating the XML document.
  Start time:                    2016-06-24 06:47:55
  End time:                      2016-06-24 06:48:15
  Requested action:              Install
  Exception help link:           http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=12.0.4100.1&EvtType=0xE0C083E6%400xF80B8030&EvtType=0xE0C083E6%400xF80B8030


Exception summary:
The following is an exception stack listing the exceptions in outermost to innermost order
Inner exceptions are being indented

Exception type: Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException
    Message: 
        There was an error generating the XML document.
    HResult : 0x84b10001
        FacilityCode : 1201 (4b1)
        ErrorCode : 1 (0001)
    Data: 
      DisableWatson = true
    Stack: 
        at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(String rootPath, Object objectToSerialize, Boolean saveToCache)
        at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(Object objectToSerialize)
        at Microsoft.SqlServer.Chainer.Infrastructure.InputSettingService.CalculateSettings(IEnumerable`1 settingIds)
        at Microsoft.SqlServer.Chainer.Infrastructure.InputSettingService.CalculateAllSettings(Boolean chainerSettingOnly)
        at Microsoft.SqlServer.Configuration.SetupExtension.FinalCalculateSettingsAction.ExecuteAction(String actionId)
        at Microsoft.SqlServer.Chainer.Infrastructure.Action.Execute(String actionId, TextWriter errorStream)
        at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.<>c__DisplayClasse.<ExecuteActionWithRetryHelper>b__b()
        at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(ActionWorker workerDelegate)
    Inner exception type: System.InvalidOperationException
        Message: 
                There was an error generating the XML document.
        HResult : 0x80131509
        Stack: 
                at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
                at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o)
                at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(String rootPath, Object objectToSerialize, Boolean saveToCache)
        Inner exception type: System.Security.Cryptography.CryptographicException
            Message: 
                        Access is denied.

            HResult : 0x80070005
            Stack: 
                        at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope)
                        at Microsoft.SqlServer.Common.SqlSecureString.WriteXml(XmlWriter writer)
                        at System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped)
                        at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write6_AgentConfigurationPublic(String n, String ns, AgentConfigurationPublic o, Boolean isNullable, Boolean needType)
                        at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write7_AgentConfigurationPublic(Object o)

当我点击它时,异常帮助链接不会去任何地方 .

我尝试使用启动进程传递凭据,但这不起作用,因为我可能使用它错误,因为我必须作为参数传递配置文件 .

我在Windows主机上运行以下ansible脚本:https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1

我知道它运行正常,因为我可以运行其他脚本,包括从S3下载文件和自动加入域 .

有没有人通过ansible在Windows中成功安装了exe文件?任何帮助都会很棒,因为我甚至可能过度简单了?

5 回答

  • 0

    我找到一个“脏”的方式安装Mssql与Ansible本地系统帐户,但它的工作 . 使用nssm,安装一个运行mssql安装程序的bat有一个服务,如下所示:

    . 蝙蝠:

    C:\ mssql_install \ setup.exe / SAPWD =“??????” /ConfigurationFile="c:\mssql_install\setupauto.ini“/ IAcceptSQLServerLicenseTerms / INDICATEPROGRESS = False / Q

    C:\ nssm.exe删除myservice确认

    net stop myservice

    与ansible:

    • name:安装服务

    raw:C:\ nssm.exe安装myservice C:\ mssql_install \ mycmd.bat

    • name:配置服务

    raw:C:\ nssm.exe设置myservice启动SERVICE_DEMAND_START

    • 名称:开始

    raw:net start myservice

    我也尝试使用psexe -s(-s用于系统帐户)但没有成功

  • 0

    我也有同样的问题 . 我尝试在我的剧本中包含以下文章中提到的注册表设置,但没有成功 . 你可以尝试一下,让我知道它是否适合你,这可能是你的问题 . https://msdn.microsoft.com/en-us/library/aa384423.aspx

    tasks:
        - name: Disable UAC Filtering for Local Accounts
          win_regedit: 
            data: 1
            datatype: dword
            key: "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"
            value: LocalAccountTokenFilterPolicy
    
  • 1

    我最终做的是使用psexec模块 . 当我使用你使用的相同命令时它运行完美,当使用其他ansible模块时,这也失败了 .

    - name: install sql
       win_psexec:
         command:  C:\Users\Administrator\Desktop\sql\Setup.exe /ConfigurationFile=C:\Users\Administrator\Desktop\ConfigurationFile.ini /INDICATEPROGRESS=False
         username: "{{Your_username}}"
         password: "{{Your_password}}"
         priority: high
         executable: "{{path_to_psexec.exe}}"
    
  • 0

    解决权限的另一种方法是创建Windows任务并使用具有管理员权限的帐户运行该任务:

    - name    : Create Install schtask
      raw     : "schtasks /create /tn \"SQLInstaller\" /tr C:\\SQL\\InstallSQLwithConfigIni.cmd /sd 01/01/1901 /ST 00:00 /sc ONCE /ru {{ansible_user}} /rp {{ansible_password}} /RL HIGHEST"
    
    - name    : Run Install schtask now
      raw     : "schtasks /run /tn \"SQLInstaller\""
    

    InstallSQLwithConfigIni.cmd的内容可以是例如:C:\ sql \ SQLEXPR_x64_ENU.exe / Q /ConfigurationFile="C:\sql\Configuration.ini“

  • 0

    我认为在此页面中捕获了问题和解决方案:https://github.com/ansible/ansible/issues/22660

    这与“多跳”有关 .

    它可能取决于您对Windows主机进行身份验证的方式,使用CredSSP建议的上述链接,尽管Kerberos也可以使用 .

相关问题