Grupo de Trabajo

Grupo de Trabajo

Postby Willi Quintana » Fri Feb 25, 2011 4:39 am

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
User avatar
Willi Quintana
 
Posts: 1010
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú

Re: Grupo de Trabajo

Postby anserkk » Fri Feb 25, 2011 5:57 am

Here is one of the ways to retrieve your PC's WorkGroup/Domain name
Code: Select all  Expand view

#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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Grupo de Trabajo

Postby Willi Quintana » Fri Feb 25, 2011 7:37 pm

Gracias,,, funciona perfectamente,....
Salu2
User avatar
Willi Quintana
 
Posts: 1010
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 32 guests