Tracy,
Note that Sergey's code will work only if you are connecting to the local machine (lcComputer = '.' or 'localhost' or '{Your local machine name}), but it will still fail if you are trying to connect to a remote machine that does not have WMI, not sure what you are trying to do, for if you are only using it for local machine, you do not need anything there, for all those values are default, you can simplify by saying GetObject("winmtmts:"), for "root/cimv2" is also the default namespace. Now, I try to avoid the use of monikers for wmi in favor of WBEM's ConnectServer('ServerName', 'NameSpace', 'UserName', 'Password') (all optional too, so ConnectServer() will suffice to connect to the root/cimv2 namespace of the local machine, so I will use
loLocator = CREATEOBJECT('WBEMScripting.SWBEMLocator')
loWMI = loLocator.ConnectServer()
Now you are not using monikers so if it errors out it is trappable, just wrap it on a try catch; but the other advantage is that with ConnectServer you can pass different credentials if you want to do so, something you can not do with monikers and there also an old bug if you use VFP 6, but that is not relevant any longer
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?
"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare
"To die for a religion is easier than to live it absolutely"
Jorge L. Borges