# Getting Access Denied error while Installing MSSQL Server on Windows server

**URL:** <https://forum.ansible.com/t/getting-access-denied-error-while-installing-mssql-server-on-windows-server/4445>\
**Category:** Get Help\
**Tags:** windows\
**Created:** [March 19, 2024, 3:11am UTC](https://forum.ansible.com/t/getting-access-denied-error-while-installing-mssql-server-on-windows-server/4445 "2024-03-19T03:11:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sshinde](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@sshinde](https://forum.ansible.com/u/sshinde)\
**Post date:** [March 19, 2024, 3:11am UTC](https://forum.ansible.com/t/getting-access-denied-error-while-installing-mssql-server-on-windows-server/4445/1 "2024-03-19T03:11:29Z")

</div>

Getting below error “Access Denied” error while Installing MSSQL Server on Windows server.

Error log :-

“Error: Action "Microsoft.SqlServer.Configuration.SmartSetupExtension.SearchUpdatesAction" threw an exception during execution.”,  
“Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException: Access is denied. (Exception from HRESULT: 0x80070005 (E\_ACCESSDENIED)) —\> System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E\_ACCESSDENIED))”

Ansible Playbook :

- name: Execute MSSQL installer  
ansible.windows.win\_command: “E:\SQLServer2022\_Install\setup.exe /ConfigurationFile=E:\SQLServer2022\_Install\SQL2022\_ConfigurationFile.INI”  
vars:  
become: true  
become\_method: runas  
become\_user: Administrator  
ansible\_user : “{{ keeper\_username.value }}”  
ansible\_password : “{{ keeper\_password.value }}”  
become\_flags: logon\_type=new\_credentials logon\_flags=netcredentials\_only

---

<div class="post-metadata">

**Author:** ![watsonb](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/watsonb/32/309_2.png) [@watsonb](https://forum.ansible.com/u/watsonb)\
**Post date:** [March 19, 2024, 10:53am UTC](https://forum.ansible.com/t/getting-access-denied-error-while-installing-mssql-server-on-windows-server/4445/2 "2024-03-19T10:53:17Z")

</div>

> [@sshinde](#):
>
> Action “Microsoft.SqlServer.Configuration.SmartSetupExtension.SearchUpdatesAction” threw an exception during execution.”

try adding `/UpdateEnabled=False` to your command (after `/ConfigurationFile`)

---

<div class="post-metadata">

**Author:** ![sshinde](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@sshinde](https://forum.ansible.com/u/sshinde)\
**Post date:** [March 19, 2024, 1:32pm UTC](https://forum.ansible.com/t/getting-access-denied-error-while-installing-mssql-server-on-windows-server/4445/3 "2024-03-19T13:32:07Z")

</div>

Thx a lot @watsonb. You are genius. I really appreciate your help in this case. 🙂

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [March 19, 2024, 7:09pm UTC](https://forum.ansible.com/t/getting-access-denied-error-while-installing-mssql-server-on-windows-server/4445/4 "2024-03-19T19:09:13Z")

</div>

There’s a few problems here

- `become`, `become_method`, `become_flags` are all task directives and not vars
- you are using become flags which are designed for network authentication not bypassing DPAPI restrictions you typically see with the SQL installer
- you need to set a password for the become user

An example:

```yaml
- ansible.windows.win_command: foo
  become: true
  become_method: runas
  vars:
    ansible_become_user: '{{ keeper_username.value }}'
    ansible_become_password: '{{ keeper_password.value }}'

```

This sets `become` and `become_method` as the task directives so the task is actually run with become. It also sets the become credentials to the same as your connection credentials without an extra flags.
