-
Notifications
You must be signed in to change notification settings - Fork 174
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 on running ansible.windows.win_updates module #540
Comments
Are you able to run |
Hi Jordan, thanks for the reply. Pretty sure the cred I put in has local administrator access on remote server. Same cred is working with an ealier version of win_updates module. I will try to revert my fix in the envionrment and add this win_whoami for another test. |
I am more curious whether the account has the |
@HaomouJi have you find a solution/workaround for this issue you are having ? |
Hi guys, this is Haomou Ji. Sorry for being late, just did the test from working envrionment. |
@imedaouidene Yes, I got a workaround. I have copied old version of both win_updates.ps1 and win_updates.py files back to the controller host via a task: |
Thanks a lot for your workaround @JamesHaomou-Ji-Westpac, it was really helpful. win_updates stopped working for me too after upgrading the collection. Weirdly it is still working for a few servers (especially those that are freshly deployed from template), I can't find the difference between them though. |
We believe we have narrowed down what part of the code is causing the access is denied error but we haven't figured out why. As I cannot replicate this issue it's very hard to figure out a fix for it. Essentially part of the new It would be great if whoever is affected by this could copy the script at https://gist.github.com/jborean93/94b3eea93dbca15e60c51247c3a7b399 to one of the affected servers and then run the following from another Windows host. Invoke-Command -ComputerName target-host -Command { & "C:\path\where\process_new_console_test.ps1" }
winrs -r:http://target-host:5985/wsman powershell.exe -File "C:\path\where\process_new_console_test.ps1" The |
Here the output from your tests:
and
|
Thanks that at least confirms it's a problem with the way that the Now as to why this is happening I'm honestly not sure. It's not something I can replicate or even explain why it might be happening. Knowing any differences between hosts that work might help narrow it down, like:
You could try and use procmon and filter by the winrs process id for testing and see if there's anything that might jump out at you. |
I'm not sure if my posting will help at all or confuse things further. Last month I successfully ran win_updates on my servers. Since then I have updated ansible and as a result the win_updates module was updated as well. I am now unable to run win_updates on some servers but on others it still completes successfully. I uninstalled our Anti-virus solution from a server that was failing and now win_updates completed successfully. I asked our security team to verify why the anti-virus solution is blocking the execution of the module. They responded that the issue is most likely not the anti-virus considering nothing changed in the last couple of months on their end and I was provided the following information. "I’m seeing some differing behavior. When you ran it this morning, I see you connect and create a scheduled task called ‘ansible-ansible.windows.win_updates’. This scheduled task opens cmd.exe, with no parameters. Then you run the task, which opens a command prompt, and then delete the task. All within a few milliseconds of each other. Basically all you’re doing is opening a command prompt. This aligns with the log you posted below in that the task is so short lived, you can’t even get the name of the process running. I looked further back to when the updates ran on Sept 27th. That time, I see you connect, but instead of creating scheduled tasks, you run an encoded powershell command. I didn’t take the time to decode it, but it’s enough to see that on the 27th, it ran via powershell commands, today, it’s running an empty scheduled task. So, why the difference in behavior? On Sept 27th there’s no scheduled tasks being created, only powershell scripts, but today, it’s creating empty tasks. So, I’m not sure why the change, or what prompted that, but I’d start looking there." Hope the snippet above adds more clarity on what is occurring in our environment. |
@calciosoccer1 thanks for sharing. Essentially the change in behaviour is down to the complexity of this module. What happens is that the Windows Update code needs to run in a context outside of the WinRM network logon as the API doesn't allow this. In the past we used to run the powershell code directly as a scheduled task using To try and provide an alternative method we now just spawn a detached process if you are running |
I can confirm, it works as expected when I use psrp instead of winrm. |
Yes it should be mostly interchangeable, in fact you would probably notice some slight speed improvements, especially with loops. I can’t say it is 100% the same but they both use WinRM as the underlying transport. |
Thank you so much for the quick reply. I managed to switch to psrp and it does work flawlessly. Once again. Thank you so much. |
I'm using open source AWX Tower via I do, however, see some integrative issues still there. Trying to switch my project's inventory transport from Internal domain servers (Kerberos/
-> probably just missing DMZ/externally hosted servers (NTLM/
|
SUMMARY
Received error message while using ansible.windows.win_updates. Ansible 1.13.0.
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
windows 2012-2019
STEPS TO REPRODUCE
EXPECTED RESULTS
list available KBs
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: