-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Get-WmiObject - Invalid class "Win32_Service" - Workaround #33322
Conversation
💚 CLA has been signed |
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
Signed. |
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
/test |
What do I need to do to keep this moving forward? |
@leehinman is looking at this. The main concern is making sure this change will work as expected across the various Windows versions we need to support. |
Awesome and glad to hear it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will also need a changelog entry.
$service.StopService() | ||
Start-Sleep -s 1 | ||
$service.delete() | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets not do the try/catch and just change to the code in the catch block.
I tested the code in the catch block on Windows 11, Windows Server 2012, 2016 & 2019. Works fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the requested changes, please let me know if there is anything further needed. Thanks for moving so quick on this!
What else needs to be done for this? |
This pull request is now in conflicts. Could you fix it? 🙏
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We just need the merge conflict in the changelog resolved and we can merge this. |
I'm not the best with git. I tried the steps and got this:
What can I do to fix? |
I was able to resolve the conflict on your branch myself via the GitHub UI. The command above is assuming you set the |
This pull request is now in conflicts. Could you fix it? 🙏
|
Merged! This will be in the 8.6 release for Beats. |
I'm looking at 8.6.2 and still do not see this pulled in? |
It should be in 8.6.2, Git certainly thinks it is looking at the tags on the merged commit 4e58e31 |
We have 8.6.2 on site and I need to apply this change by hand. Maybe someone didn't push a specific button or? |
The commit is part of the 8.6.2 release, Git shows that it is and you can see it if you go far enough back in the 8.6.2 commit history. It is one of the last commits in https://github.com/elastic/beats/commits/v8.6.2?after=9b77c2c135c228c2eedc310f6e975bb1a76169b1+139&branch=v8.6.2&qualified_name=refs%2Ftags%2Fv8.6.2 If it isn't working it is possible something was missed as part of the fix here, possibly something that is part of the build and packaging step. |
* Get-WmiObject - Invalid class "Win32_Service" - Workaround * try/catch replace + changelog documentation * Changelog fix Co-authored-by: Lee E. Hinman <[email protected]> Co-authored-by: Craig MacKenzie <[email protected]>
Was there more information about the root cause of win32_service issues? |
This never made it into the release. I am currently working at 8.11.x and not seeing it. |
What does this PR do?
This PR adds a workaround to a situation in Windows where calling Get-WmiObject returns "Win32_Service" as an Invalid class.
Why is it important?
This is important to users which remotely deploy and install any of the Beats in a Windows environment. Rather than solving the class issue I focused on a workaround which can be provided until a proper solution to the class issue is found.
Checklist
- [ ] I have commented my code, particularly in hard-to-understand areas- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration files- [ ] I have added tests that prove my fix is effective or that my feature works- [ ] I have added an entry inCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Build any Beats package and then run the associated installer for Windows.
Related issues
Use cases
Windows zipfile deployments for service installations.
Screenshots
N/A
Logs
N/A