Sign in to follow this  
Followers 0
mattw112

WMI Error

3 posts in this topic

I created a simple GUI with some buttons on it.

If a button is pushed then it displays some info from WMI.

This works great the first time you push a button and it displays the info, if you push the button a second time then you get the -1 "Variable must be of type "Object." error.

Is there something within the function (WMI Functions in general) I need to close or flush out after the function completes the first time so it can be used again?

Thanks,

Terry

Share this post


Link to post
Share on other sites



You don't have to destroy the object variable like you would in WSH, if that's what you're asking.

Apart from that, it sounds more like a logic issue.

Post what you have and we'll take a look.


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Thanks,

Actually I just found it.

basically I needed to clear out the $computer variable in my for loop...

For $Computer in $Computers

MsgBox(0, "TEST", $computer.Name)

Next

Once I put $computer = "" at the top of the function it works now as many times as I want to push the button.

Thanks,

Terry

Share this post


Link to post
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
Sign in to follow this  
Followers 0