# Access Denied Error while installing SQLServer using Ansible on remote Windows host.

**URL:** <https://forum.ansible.com/t/access-denied-error-while-installing-sqlserver-using-ansible-on-remote-windows-host/26599>\
**Category:** Ansible Project\
**Tags:** azure, windows\
**Created:** [January 30, 2018, 12:55pm UTC](https://forum.ansible.com/t/access-denied-error-while-installing-sqlserver-using-ansible-on-remote-windows-host/26599 "2018-01-30T12:55:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![suresh\_sargar](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@suresh\_sargar](https://forum.ansible.com/u/suresh_sargar)\
**Post date:** [January 30, 2018, 12:55pm UTC](https://forum.ansible.com/t/access-denied-error-while-installing-sqlserver-using-ansible-on-remote-windows-host/26599/1 "2018-01-30T12:55:11Z")

</div>

Hi All,

i am trying to install SQLServer in silent mode on remote windows machine using ansible. in middle of execution its failed with below error. my target host is Azure Windows.

2018-01-30 12:27:47,300 [StandardOutput] INFO PATools - Action: Calculating default service account for AS engine Service  
2018-01-30 12:27:47,300 [StandardOutput] INFO PATools - Data: User Name = NT AUTHORITY\SYSTEM  
2018-01-30 12:27:47,300 [StandardOutput] INFO PATools - Data: Role=  
2018-01-30 12:27:47,300 [StandardOutput] INFO PATools - Data: Is Domain Controller =False  
2018-01-30 12:27:47,300 [StandardOutput] INFO PATools - Sco: Attempting to determine if the password is required for account ‘NT AUTHORITY\SYSTEM’  
2018-01-30 12:27:47,300 [StandardOutput] INFO PATools - Sco: Attempting to determine if the account ‘NT AUTHORITY\SYSTEM’ is Virtual Account  
2018-01-30 12:27:47,300 [StandardOutput] INFO PATools - Sco: Attempting to get local system account name  
2018-01-30 12:27:47,300 [StandardOutput] INFO PATools - Sco: Attempting to get NT account from sid S-1-5-18  
2018-01-30 12:27:47,300 [StandardOutput] INFO PATools - Sco: Attempting to get account from sid S-1-5-18  
2018-01-30 12:27:47,315 [StandardOutput] INFO PATools - Sco: Attempting to get account sid for user account NT AUTHORITY\SYSTEM  
2018-01-30 12:27:47,315 [StandardOutput] INFO PATools - Sco: Attempting to get sid for user account NT AUTHORITY\SYSTEM  
2018-01-30 12:27:47,315 [StandardOutput] INFO PATools - Sco: GetSidForAccount normalized accountName NT AUTHORITY\SYSTEM parameter to NT AUTHORITY\SYSTEM  
2018-01-30 12:27:47,315 [StandardOutput] INFO PATools - Data: User Name = NT AUTHORITY\SYSTEM after calculating default service account.  
2018-01-30 12:27:47,315 [StandardOutput] INFO PATools - Result: Completed calculating default service account for AS engine service  
2018-01-30 12:27:47,331 [StandardOutput] INFO PATools - Action Scenario: Install, Feature Scenario: Install, Resolved Scenario Install  
2018-01-30 12:27:47,331 [StandardOutput] INFO PATools - Action Scenario: Install, Feature Scenario: Install, Resolved Scenario Install  
2018-01-30 12:27:47,347 [StandardOutput] INFO PATools - SqlEngine: Calculating default service account for engine service. Current value of SqlAccount: NT AUTHORITY\SYSTEM  
2018-01-30 12:27:47,347 [StandardOutput] INFO PATools - SqlEngine: Completed calculating default service account for engine service. Final value of SqlAccount: NT AUTHORITY\SYSTEM  
2018-01-30 12:27:47,382 [StandardOutput] INFO PATools - Error: Action “Microsoft.SqlServer.Configuration.SetupExtension.FinalCalculateSettingsAction” threw an exception during execution.  
2018-01-30 12:27:47,393 [StandardOutput] INFO PATools - Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException: There was an error generating the XML document. —\> Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException: There was an error generating the XML document. —\> System.InvalidOperationException: There was an error generating the XML document. —\> System.Security.Cryptography.CryptographicException: Access is denied.  
2018-01-30 12:27:47,393 [StandardOutput] INFO PATools - at System.Security.Cryptography.ProtectedData.Protect(Byte userData, Byte optionalEntropy, DataProtectionScope scope)  
2018-01-30 12:27:47,393 [StandardOutput] INFO PATools - at Microsoft.SqlServer.Common.SqlSecureString.WriteXml(XmlWriter writer)  
2018-01-30 12:27:47,393 [StandardOutput] INFO PATools - at System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped)  
2018-01-30 12:27:47,393 [StandardOutput] INFO PATools - at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterSqlEngineSetupPublic.Write7\_SqlEngineSetupPublic(String n, String ns, SqlEngineSetupPublic o, Boolean isNullable, Boolean needType)  
2018-01-30 12:27:47,393 [StandardOutput] INFO PATools - at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterSqlEngineSetupPublic.Write8\_SqlEngineSetupPublic(Object o)  
2018-01-30 12:27:47,393 [StandardOutput] INFO PATools - — End of inner exception stack trace —

The problem is how do i run .exe with Run as Administrator mode using Ansible. the current execution user is a part of Administrative group only. Please suggest how do i fix this.

Please find complete installation log of SQLServer.

Thanks,  
Suresh.

---

<div class="post-metadata">

**Author:** ![suresh\_sargar](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@suresh\_sargar](https://forum.ansible.com/u/suresh_sargar)\
**Post date:** [January 30, 2018, 1:03pm UTC](https://forum.ansible.com/t/access-denied-error-while-installing-sqlserver-using-ansible-on-remote-windows-host/26599/2 "2018-01-30T13:03:00Z")

</div>

I tried with Win\_shell and Win\_command module both are giving same error.
