Page 1 of 1
Grupo de Trabajo
Posted: Fri Feb 25, 2011 4:39 am
by Willi Quintana
Hola amigos:
NetName() nos devuelve el nombre de la PC, NetName(.t.) el nombre del usuario; alguna funcion para obtener el nombre del GRUPO DE TRABAJO ??
Salu2
Re: Grupo de Trabajo
Posted: Fri Feb 25, 2011 5:57 am
by anserkk
Here is one of the ways to retrieve your PC's WorkGroup/Domain name
Code: Select all | Expand
#Include "FiveWin.ch"
//-----------------------//
Function Main()
Local oLoc,oWmi,oList,oItem
oLoc:= CreateObject( "wbemScripting.SwbemLocator" )
oWmi:= oLoc:ConnectServer()
If oWmi == NIL
? "Sorry!! No Wmi"
Return
Endif
oList := oWmi:ExecQuery("Select * from Win32_ComputerSystem")
FOR EACH oItem IN oList
cComputerDomain = oItem:Domain
If oItem:PartOfDomain
? "Computer Domain: " + cComputerDomain
Else
? "Workgroup: " + cComputerDomain
EndIf
Next
Return NIL
Please note :-WMI is not available before Windows 2000 (unless it is installed separately).
Microsoft's document states that if the computer is not joined to a domain, the domain property of the Win32_ComputerSystem class is the name of the workgroup.
Regards
Anser
Re: Grupo de Trabajo
Posted: Fri Feb 25, 2011 7:37 pm
by Willi Quintana
Gracias,,, funciona perfectamente,....
Salu2