Hello! I'm from Brazil so, forgive my english. I have a problem: I installed WMI in Windows 98 to get some informations, and one of this is the name of workgroup. I get the computer name, but when my function (thanks mgagnon!!!) trys to get the workgroup name I get this error message: "OLE error code 0x080020006: Unknown name". My function returns it correctly in Win XP.
objWMISvc = GETOBJECT("winmgmts:\\.\root\cimv2")
colItems = objWMISvc.ExecQuery("Select * from Win32_ComputerSystem", , 48)
FOR EACH objItem IN colItems
strComputerName = objItem.Name
strComputerDomain = objItem.WorkGroup
IF objItem.PartOfDomain
? "Computer Domain: " + strComputerDomain
ELSE
? "Workgroup: " + strComputerDomain
? "Computer Name: " + strComputerName
ENDIF
NEXT
objWMISvc = GETOBJECT("winmgmts:\\.\root\cimv2")
colItems = objWMISvc.ExecQuery("Select * from Win32_ComputerSystem", , 48)
FOR EACH objItem IN colItems
strComputerName = objItem.Name
strComputerDomain = objItem.WorkGroup
IF objItem.PartOfDomain
? "Computer Domain: " + strComputerDomain
ELSE
? "Workgroup: " + strComputerDomain
? "Computer Name: " + strComputerName
ENDIF
NEXT