mattw112 Posted December 23, 2008 Share Posted December 23, 2008 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 Link to comment Share on other sites More sharing options...
Skruge Posted December 23, 2008 Share Posted December 23, 2008 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] Link to comment Share on other sites More sharing options...
mattw112 Posted December 23, 2008 Author Share Posted December 23, 2008 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now