# CreateProcessAsUser failed with Win32ErrorCode 1058 when running become: true on a Windows host?

**URL:** <https://forum.ansible.com/t/createprocessasuser-failed-with-win32errorcode-1058-when-running-become-true-on-a-windows-host/2864>\
**Category:** Get Help\
**Tags:** winrm, windows, aap, collections\
**Created:** [December 12, 2023, 9:36am UTC](https://forum.ansible.com/t/createprocessasuser-failed-with-win32errorcode-1058-when-running-become-true-on-a-windows-host/2864 "2023-12-12T09:36:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DevOpsJeremy](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/devopsjeremy/32/5030_2.png) [@DevOpsJeremy](https://forum.ansible.com/u/DevOpsJeremy)\
**Post date:** [December 12, 2023, 9:36am UTC](https://forum.ansible.com/t/createprocessasuser-failed-with-win32errorcode-1058-when-running-become-true-on-a-windows-host/2864/1 "2023-12-12T09:36:43Z")

</div>

I’m using Ansible Automation Platform. I’m trying to run a task (specifically [`community.windows.win_credential`](https://docs.ansible.com/ansible/latest/collections/community/windows/win_credential_module.html)) on a Windows host using `become: true`, but it’s failing with the following error:

```json
{
  "exception": "Exception calling \"CreateProcessAsUser\" with \"9\" argument(s): \"CreateProcessWithTokenW() failed (The service cannot be started, either because it is disabled or because it has no enabled devices associated with it, Win32ErrorCode 1058)\"\r\nAt line:103 char:5\r\n+ $result = [Ansible.Become.BecomeUtil]::CreateProcessAsUser($usern ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \r\n + CategoryInfo : NotSpecified: (:) [], MethodInvocationException\r\n + FullyQualifiedErrorId : Win32Exception\r\n\r\nScriptStackTrace:\r\nat <ScriptBlock>, <No file>: line 103\r\nat <ScriptBlock><End>, <No file>: line 137\r\nat <ScriptBlock>, <No file>: line 11\r\n\r\nSystem.Management.Automation.MethodInvocationException: Exception calling \"CreateProcessAsUser\" with \"9\" argument(s): \"CreateProcessWithTokenW() failed (The service cannot be started, either because it is disabled or because it has no enabled devices associated with it, Win32ErrorCode 1058)\" ---> Ansible.Process.Win32Exception: CreateProcessWithTokenW() failed (The service cannot be started, either because it is disabled or because it has no enabled devices associated with it, Win32ErrorCode 1058)\r\n at Ansible.Become.BecomeUtil.CreateProcessAsUser(String username, String password, LogonFlags logonFlags, LogonType logonType, String lpApplicationName, String lpCommandLine, String lpCurrentDirectory, IDictionary environment, Byte[] stdin) in c:\\Users\\myUser\\AppData\\Local\\Temp\\rwchbapb.1.cs:line 309\r\n at CallSite.Target(Closure , CallSite , Type , Object , Object , Object , Object , Object , Object , Object , Object , Object )\r\n --- End of inner exception stack trace ---\r\n at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)\r\n at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)\r\n at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\n at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)",
  "msg": "internal error: failed to become user 'myUser': Exception calling \"CreateProcessAsUser\" with \"9\" argument(s): \"CreateProcessWithTokenW() failed (The service cannot be started, either because it is disabled or because it has no enabled devices associated with it, Win32ErrorCode 1058)\"",
  "_ansible_no_log": false,
  "changed": false
}

```

The user is in the local Administrators group in the host. The Privilege Escalation Method (runas), Username, and Password are set on the Machine credential. Username and Password are the same that are used to log into the host.

I found [this issue](https://github.com/ansible/ansible/issues/69086) and followed some of the troubleshooting steps on there with no change.

I’ve tried running the task without `become`, but Ansible throws an error that it must be run with `become`:

> Failed to access the user’s credential store, run the module with become.

Does anyone know how I can get this working?

---

<div class="post-metadata">

**Author:** ![DevOpsJeremy](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/devopsjeremy/32/5030_2.png) [@DevOpsJeremy](https://forum.ansible.com/u/DevOpsJeremy)\
**Post date:** [October 16, 2024, 4:31pm UTC](https://forum.ansible.com/t/createprocessasuser-failed-with-win32errorcode-1058-when-running-become-true-on-a-windows-host/2864/2 "2024-10-16T16:31:28Z")

</div>

I was unable to use `become` on Windows because the `seclogon` service was not running. After starting that I was able to successfully run `community.windows.win_credential` with `become`.

This requirement is in the Ansible documentation [here](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_privilege_escalation.html#limitations-of-become-on-windows).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 15, 2024, 4:32pm UTC](https://forum.ansible.com/t/createprocessasuser-failed-with-win32errorcode-1058-when-running-become-true-on-a-windows-host/2864/3 "2024-11-15T16:32:10Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
