Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with win_msg module #533

Open
KhedekarS opened this issue Sep 4, 2023 · 2 comments
Open

issue with win_msg module #533

KhedekarS opened this issue Sep 4, 2023 · 2 comments

Comments

@KhedekarS
Copy link

I am getting this error after running the code on windows servers

error

{
"exception": "Error sending message to session Console : Error 2147500058 \nAt line:37 char:15\r\n+ $output = & msg.exe $msg_args 2>&1\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~\n + CategoryInfo : NotSpecified: (Error sending m...ror 2147500058 :String) [], RemoteException\n + FullyQualifiedErrorId : NativeCommandError\r\n\r\nScriptStackTrace:\r\nat , : line 37\r\n",
"msg": "Unhandled exception while executing module: Error sending message to session Console : Error 2147500058 ",
"_ansible_no_log": false,
"changed": false
}

@hiyokotaisa
Copy link
Contributor

It seems that error is coming from Windows Server itself. Are you facing this issue intermittently or everytime you run the task?

@njt-cla
Copy link

njt-cla commented Apr 22, 2024

Hello, I am facing the same error too.
To give some context, I run a simple playbook on 2 Windows 2k16 servers that have the same configuration :

PS C:\ > $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14393  6343

Winver gives OS Build : Version 1607 (OS Build 14393.6897).

The playbook looks like that :

---
- hosts: all
  gather_facts: true
  tasks:
    - name: Send a test message to servers
      win_msg:
        display_seconds: 120
        msg: "This is a test message, you can press OK to close it."

My real message contains less than 120 characters (far from the 256 char limit) and the following behavior happens :

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
task path: /path/to/my/playbook.yml:2
redirecting (type: modules) ansible.builtin.setup to ansible.windows.setup
Using module file /path/to/python/site-packages/ansible_collections/ansible/windows/plugins/modules/setup.ps1
Pipelining is enabled.
<my.server.2.fqdn> ESTABLISH PSRP CONNECTION FOR USER: DOMAIN\MYADMINUSER ON PORT 5986 TO my.server.2.fqdn
redirecting (type: modules) ansible.builtin.setup to ansible.windows.setup
Using module file /path/to/python/site-packages/ansible_collections/ansible/windows/plugins/modules/setup.ps1
Pipelining is enabled.
<my.server.1.fqdn> ESTABLISH PSRP CONNECTION FOR USER: DOMAIN\MYADMINUSER ON PORT 5986 TO my.server.1.fqdn
PSRP: EXEC (via pipeline wrapper)
PSRP: EXEC (via pipeline wrapper)
ok: [my.server.1]
ok: [my.server.2]

TASK [Send a test message to servers] ***********************************************
task path: /path/to/my/playbook.yml:5
redirecting (type: modules) ansible.builtin.win_msg to community.windows.win_msg
redirecting (type: modules) ansible.builtin.win_msg to community.windows.win_msg
Using module file /path/to/python/site-packages/ansible_collections/community/windows/plugins/modules/win_msg.ps1
Pipelining is enabled.
redirecting (type: modules) ansible.builtin.win_msg to community.windows.win_msg
<my.server.2.fqdn> ESTABLISH PSRP CONNECTION FOR USER: DOMAIN\MYADMINUSER ON PORT 5986 TO my.server.2.fqdn
redirecting (type: modules) ansible.builtin.win_msg to community.windows.win_msg
Using module file /path/to/python/site-packages/ansible_collections/community/windows/plugins/modules/win_msg.ps1
Pipelining is enabled.
<my.server.1.fqdn> ESTABLISH PSRP CONNECTION FOR USER: DOMAIN\MYADMINUSER ON PORT 5986 TO my.server.1.fqdn
PSRP: EXEC (via pipeline wrapper)
PSRP: EXEC (via pipeline wrapper)
changed: [my.server.1] => {
    "changed": true,
    "display_seconds": 120,
    "msg": "This is a test message, you can press OK to close it.",
    "rc": 0,
    "runtime_seconds": 0.12578309999999998,
    "sent_localtime": "Monday, April 22, 2024 4:52:23 PM",
    "wait": false
}
The full traceback is:
Error sending message to session Console : Error 2147500058 
At line:37 char:15

+     $output = & msg.exe $msg_args 2>&1

+               ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Error sending m...ror 2147500058 :String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError



ScriptStackTrace:

at <ScriptBlock>, <No file>: line 37

fatal: [my.server.2]: FAILED! => {
    "changed": false,
    "msg": "Unhandled exception while executing module: Error sending message to session Console : Error 2147500058 "
}

The message is sent to both servers and I am able to see it on both servers, but one task fails.
The error is present while trying to run the command on the server directly, the full error message is the following :

Error sending message to session Console : Error 2147500058
Error [2147500058]:The server process could not be started because the configured identity is incorrect. Check the username and password.

Do you have any idea on how to fix this problem ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants