Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

workgroup name 1

Status
Not open for further replies.

knela

Programmer
Jan 26, 2007
13
BR
Hello! I want to use the function ANETRESOURCES() to get the name of computers in a workgroup. But ANERRESOURCES() needs to specify the name of workgroup. Searching for a function to do it, I found a API named NetGetJoinInformation. Is it the better function to get the name of workgroup? How can I use it on Visual FoxPro 9? Thank!!!
 
You can do it with WMI. If there is a workgroup involved it will show.
Code:
objWMISvc = GetObject( "winmgmts:\\.\root\cimv2" )
colItems = objWMISvc.ExecQuery( "Select * from Win32_ComputerSystem", , 48 )
For Each objItem in colItems
    strComputerDomain = objItem.Domain
    If objItem.PartOfDomain 
        ? "Computer Domain: " + strComputerDomain
    Else
        ? "Workgroup: " + strComputerDomain
    EndIf
Next

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
THANKS A LOT MIKE!!!! It was so helpfull!! Sorry, I have more one doubt: I run it on Windows XP but in Windows 98 it didn't work. Would you tell me how can I adapt it to Win98 (with VFP9)? One more time, thanks a lot!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top