Comments (8)
@mholt "not maintained" may be slight overstatement, but yeah, we haven't needed a lot of changes lately. Can definitely review a pr if you want.
from wmi.
To call a method, you need to retrieve the class and call an object like this
// Connect to namespace
// root/PanasonicPC = winmgmts:\\.\root\PanasonicPC
serviceRaw, err := oleutil.CallMethod(wmi, "ConnectServer", nil, "root/PanasonicPC")
if err != nil {
log.Panic(err)
}
service := serviceRaw.ToIDispatch()
defer serviceRaw.Clear()
// Get class
setBiosRaw, err := oleutil.CallMethod(service, "Get", "SetBIOS4Conf")
if err != nil {
log.Panic(err)
}
setBios := setBiosRaw.ToIDispatch()
defer setBiosRaw.Clear()
// Run method
resultRaw, err := oleutil.CallMethod(setBios, "AccessAuthorization", "letmein")
resultVal := resultRaw.Value().(int32)
from wmi.
I'm extremely interested in this. How can I help make this happen? Would you accept a PR?
@JamesCullum Were you able to get that working external to this library, or did you put that inside this package?
EDIT: Nevermind, I see now that it relies on wmi
as created in the CreateQuery
method. I've got your code working, I think. Would a PR be reviewed and accepted?
EDIT 2: Okay, yes, I've triply confirmed I have this working. Let me know if you want the PR...
from wmi.
Hey @mholt,
It's a separate code, that is dependant on oleutil
& wmi
- not specificially this wrapper.
My code is more of a sample to show how to do it. I think a RP would be useful, but then it would need a more clean interface. Do you want to create one or how do we want to do it?
I'm not sure how the maintenance of this repository works, it looks not properly maintained.
from wmi.
@JamesCullum Yeah, I think I have an idea of what I want it to look like, but I would appreciate your review so it can handle your use cases, too. (My use case so far is only a single method.)
It doesn't appear to be maintained anymore :( So I'm thinking of forking it and making the change to my own repo...
from wmi.
Yay! I'll try to put one together today or tomorrow!
(I meant no offense of course. This library has already saved my bacon at least twice.)
from wmi.
Feel free to take a look at #45
from wmi.
Thank you for the quick work. Reviewed the changes and put that into the PR.
from wmi.
Related Issues (20)
- Tag a 1.0.0 release please HOT 1
- go test hangs
- failed to print string array HOT 5
- should be `runtime.UnlockOSThread()` HOT 2
- Getting "Not supported" as the error code when querying for data running as a windows service
- Can't query from Win32_VolumeChangeEvent
- Tag new release? HOT 3
- Invalid class when querying Win32_Process HOT 2
- Wmi class names invalid for golint
- enhansement: add ability to load result to map[string]interface{} HOT 1
- [Helper] WMI Date to datetime conversion
- Memory Leak HOT 6
- Invoke the method of the class
- get package Failed HOT 4
- Possible memory leak in coinitService for CallMethod HOT 1
- Can you do a new "release" for v1.2.1 HOT 7
- Cannot load LoadPercentage HOT 4
- Calling a method after a query
- Checksum Mismatch HOT 2
- Update go-ole to get fix for Windows on Arm HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wmi.