Coder Social home page Coder Social logo

Comments (8)

captncraig avatar captncraig commented on September 17, 2024 2

@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.

JamesCullum avatar JamesCullum commented on September 17, 2024 1

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.

mholt avatar mholt commented on September 17, 2024

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.

JamesCullum avatar JamesCullum commented on September 17, 2024

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.

mholt avatar mholt commented on September 17, 2024

@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.

mholt avatar mholt commented on September 17, 2024

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.

mholt avatar mholt commented on September 17, 2024

Feel free to take a look at #45

from wmi.

JamesCullum avatar JamesCullum commented on September 17, 2024

Thank you for the quick work. Reviewed the changes and put that into the PR.

from wmi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.