-
Notifications
You must be signed in to change notification settings - Fork 177
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
win_service_info errors out #556
Comments
I am seeing this also, the docs are indicating name can be omitted but that causes an error, I also tried with just |
The question is what is missing on the systems that does not work? I have 4 systems that errors out and 20 that work ok. |
Hmm we do have a catch block for this code but it seems like this is throwing a different exception type ansible.windows/plugins/modules/win_service_info.ps1 Lines 30 to 44 in 052ef99
We probably need to just do a generic |
I've opened #559 which should treat this error as a warning and display what service it failed on. From there we can look further into why it failed but it might not be something we can fix up in Ansible as it's an error from the underlying Windows APIs. |
Excellent, I am looking forward to test this when is merged |
I've tried to update ansible, I even added code myself to my instance, for me it doesn't work. |
SUMMARY
On some windows pcs I get an error when trying to use this module. Not on all, on dome it works ok.
ISSUE TYPE
COMPONENT NAME
win_service_info
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
target win 10 and win 11 laptops
STEPS TO REPRODUCE
I am trying to the the state of all services to use this info in disabling some of them
EXPECTED RESULTS
On one laptop and some pc's everything works as expected
ACTUAL RESULTS
On 4 of 5 laptops I get this:
Verbose:
The full traceback is: Exception calling ".ctor" with "2" argument(s): "Failed to query service config (The system cannot find the file specified, Win32ErrorCode 2 - 0x00000002)" At line:31 char:24 + ... $service = New-Object -TypeName Ansible.Windows.SCManager.Service -A ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand ScriptStackTrace: at <ScriptBlock>, <No file>: line 31 System.Management.Automation.MethodInvocationException: Exception calling ".ctor" with "2" argument(s): "Failed to query service config (The system cannot find the file specified, Win32ErrorCode 2 - 0x00000002)" ---> ansible_collections.ansible.windows.plugins.module_utils.SCManager.ServiceManagerException: Failed to query service config (The system cannot find the file specified, Win32ErrorCode 2 - 0x00000002) at ansible_collections.ansible.windows.plugins.module_utils.SCManager.Service.Refresh() in c:\Users\user\AppData\Local\Temp\4cqilajp.0.cs:line 1273 --- End of inner exception stack trace --- at System.Management.Automation.DotNetAdapter.AuxiliaryConstructorInvoke(MethodInformation methodInformation, Object[] arguments, Object[] originalArguments) at System.Management.Automation.DotNetAdapter.ConstructorInvokeDotNet(Type type, ConstructorInfo[] constructors, Object[] arguments) at Microsoft.PowerShell.Commands.NewObjectCommand.CallConstructor(Type type, ConstructorInfo[] constructors, Object[] args) fatal: [laptop1]: FAILED! => changed=false msg: 'Unhandled exception while executing module: Exception calling ".ctor" with "2" argument(s): "Failed to query service config (The system cannot find the file specified, Win32ErrorCode 2 - 0x00000002)"'
The text was updated successfully, but these errors were encountered: