Skip to content

Add WMI set capability #946

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

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Conversation

Gijsreyn
Copy link
Contributor

@Gijsreyn Gijsreyn commented Jul 8, 2025

PR Summary

This PR adds the set capability on the WMI adapter #475. Traditionally, resources should have set, but in the case of WMI resources, it requires a method name and optionally parameters. These are filtered out during a Get operation, but canonical during a Set.

PR Context

@Gijsreyn Gijsreyn force-pushed the wmi-set-operation branch from 8d882c3 to 1b25654 Compare July 8, 2025 04:16
@SteveL-MSFT
Copy link
Member

@Gijsreyn I appreciate your attempt here, but I think the problem is more complex. Some WMI classes actually support set like Win32_Environment (and gets even more complex due to Create or Update) and others like Win32_NetworkAdapter has a method SetPowerState() to power cycle it. I don't think it's worth trying to abstract this as it requires a knowledge base somewhere. Instead, it may make sense to have a different resource like Microsoft.Windows.WMI/MethodInvocation that takes a namespace, classname, method, and parameters and have set just try to call the WMI/CIM set operation.

@Gijsreyn
Copy link
Contributor Author

Thanks @SteveL-MSFT. If you want me to hit that one up, let me know. Before doing so, let's have a quick talk on the design on the thing.

@SteveL-MSFT
Copy link
Member

@Gijsreyn let's queue this up for next WG meeting

@SteveL-MSFT SteveL-MSFT moved this to In Progress in DSC Working Group Jul 15, 2025
@SteveL-MSFT SteveL-MSFT moved this from In Progress to Todo in DSC Working Group Jul 15, 2025
@Gijsreyn
Copy link
Contributor Author

It was more work than expected @SteveL-MSFT, but as discussed during WG meeting, I have implemented the Set method. There have been some changes to the function to support both create/update. That's the reason some logic is moved to functions.

Probably in the documentation, we can make a note that it does not apply to CimClassMethods and static methods. I would appreciate it if you got time to do a review :)

@Gijsreyn Gijsreyn requested a review from SteveL-MSFT July 19, 2025 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants