Jump to content

WMI and put


 Share

Recommended Posts

I've tried searching on this and not really found much.

I want to edit a value of a property of an instance in a WMI Class.

I see lots of posts on reading WMI but not really much on editing an existing value.

I did find a couple posts where people rename drives or create printers but I'm still not getting it to work.

; Set the WMI-Service
$o_WMIService  = ObjGet("winmgmts:\\.\root\N1E\WakeUp")

$o_Agents = $o_WMIService.ExecQuery("SELECT * FROM Agents", "WQL")

For $o_Agent in $o_Agents
    MsgBox(0, "TEST",  $o_Agent.AgentNameAlt)

    If $o_Agent.IP_Subnet = "192.168.12.0" Then
                $o_Agent.AgentNameAlt = "S01-DC1"
        $o_Agent.Put_
        MsgBox(0, "TEST", "After Put")
    EndIf

Next

Using this code I get the first message box with the current values. When it gets to the value which has the IP_Subnet specified then I get an error (80020009) no description??

Are there better examples of how I can edit a Instance in WMI for just one property?

Thanks,

Terry

Link to comment
Share on other sites

I've tried searching on this and not really found much.

I want to edit a value of a property of an instance in a WMI Class.

I see lots of posts on reading WMI but not really much on editing an existing value.

I did find a couple posts where people rename drives or create printers but I'm still not getting it to work.

; Set the WMI-Service
$o_WMIService  = ObjGet("winmgmts:\\.\root\N1E\WakeUp")

$o_Agents = $o_WMIService.ExecQuery("SELECT * FROM Agents", "WQL")

For $o_Agent in $o_Agents
    MsgBox(0, "TEST",  $o_Agent.AgentNameAlt)

    If $o_Agent.IP_Subnet = "192.168.12.0" Then
                $o_Agent.AgentNameAlt = "S01-DC1"
        $o_Agent.Put_
        MsgBox(0, "TEST", "After Put")
    EndIf

Next

Using this code I get the first message box with the current values. When it gets to the value which has the IP_Subnet specified then I get an error (80020009) no description??

Are there better examples of how I can edit a Instance in WMI for just one property?

Thanks,

Terry

Post a link to the "N1E\Wakeup" interface description. Does it include the .put method? Is the .AgentNameAlt property read/write?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Hmm... I dont know if there is one.

Is there a way I can tell? I'm using WMIExplorer and it has a lot of features.

So I was thinking the put_ was just a WMI thing? After you make changes you use put to make them stick... so you are saying that maybe that isn't the case?

Also I was thinking anything could be read or write? How would I change this? I saw some flags Which I also tried using with the put_(0x0)

Which means for changes I think.

Thanks,

Terry

Edited by mattw112
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...