2016-06-24 9 views
0

私は実際にこの質問をスーパーユーザーに投稿しましたが、間違った場所にある可能性があります。謝罪いたします。Windows Server 2012およびSQL Server 2014で対応しています

私はWindowsサーバーを管理するためにWinRMと一緒に遊んでいましたが、基本的なコマンドを実行するのに少し成功しました。

しかし、私がpowershellスクリプト内からexeファイルを実行しようとすると失敗します。

私はWindowsから直接実行すると、同じpowershellスクリプトは、エラーなしで完全に実行されます。それがスローする唯一のエラーは、アクセス権にリンクするアクセス拒否エラーですが、管理者であるにもかかわらず完全なアクセス権は必要ありませんか?

私が実行しようとする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) 

例外ヘルプリンクは、クリックしてもどこにも移動しません。

私は資格情報もStart-Processと一緒に渡しましたが、設定ファイルをパラメータとして渡す必要があるため、おそらく間違って使用しているため、どちらも機能しません。それは私には、他のスクリプトを実行することができますよう、細かい作業S3からファイルをダウンロードし、ドメインに自動参加だhttps://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1

そして、私が知っている:

私は、Windowsホスト上で次のansibleスクリプトを実行してきました。

誰かが安全にWindowsにexeファイルを正常にインストールしましたか?どのような助けが素晴らしいだろうか?

+0

ドメインユーザーを使用しているかどうか、使用している場合は、使用している認証メカニズム(NTLM、Kerberosなど)については言及していません。また、Anecessとpywinrmのバージョンは?この情報は、間違っている可能性を絞り込みます。 – nitzmahone

+0

私はAnsibleという名前のローカルユーザーと、同じパスワードを持つAnsibleという名前のドメインユーザーを作成しました。 Kerberosは動作しておらず、認証に失敗したため、ユーザー名だけを渡す必要がありました。危険なユーザーは、ローカルアカウントとドメインアカウントの両方に対して完全な管理権限を持ちます。 Aniableバージョン:2.1.0.0とpywinrmバージョン:0.2.0 –

答えて

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

私は、ローカルシステムアカウントでAnsibleとMSSQLをインストールするための「汚い」方法を見つけ、それが仕事です。

の.bat:

C:\ mssql_install \ SETUP.EXE/SAPWD = "??????" NSSMで 、MSSQLインストーラは、このようなサービスを、持って実行してバットをインストール/ConfigurationFile="c:\mssql_install\setupauto.ini "/ IAcceptSQLServerLicenseTerms/INDICATEPROGRESS = False/Q

C:\ nssm。exeファイルansibleでMYSERVICE確認

ネット停止MYSERVICE

を削除:

  • 名:C:\ mssql_install \のMycmd:\ nssm.exe MYSERVICEのCをインストールサービス

    生インストールします。バット

  • 名前:構成サービス

    生:C:\ nssm.exe設定MYSERVICE開始SERVICE_DEMAND_START

  • 名:開始

    生:純開始MYSERVICE

私は、システムアカウントのpsexe -s(-sとしてみてください

)成功なし

+0

nssmと.batファイルを使用するとよいでしょう。しかし、ここではrawモジュールの使用を避けるべきです。 [この回答](http://stackoverflow.com/a/41426146/4964553)に記載されているように[win_nssm module](https://docs.ansible.com/ansible/win_nssm_module.html)があります。実際のWindowsサービスを手に入れるためには、[win_service module](https://docs.ansible.com/ansible/win_service_module.html)から最終的に管理することができます。 – jonashackt

0

私がやったことは、psexecモジュールを使うことでした。あなたが使用したコマンドと同じコマンドを使用したときには完璧に動いていました。権限を回避するには

- 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も動作する可能性があります。

関連する問題