Well, there's obviously something missing for you to run WMI queries. I'm no expert in that area but both scripts works fine for me.