Share via


MSFT_Computer.Domain Property

Gets the domain to which the computer belongs.

 string MSFT_Computer.Domain

Access

Read/write

Return Value

String

Examples

The following example shows the use of the Domain property.

'*********************************************************************
' Routine: Function ListAllComputers
' Purpose: Prints the domain and name for each computer.
' Arguments: MOM server name.
' Returns: The number of computers.
'
'**********************************************************************

Function ListAllComputers(strMOMServer)
    Dim objComputers, objComputer
    Dim lngCount

    Set objComputers = GetObject("WinMgmts://" & strMOMServer & "\root\MOM").ExecQuery("SELECT * FROM MSFT_Computer")

    lngCount = objComputers.Count

    For Each objComputer In objComputers
        WScript.Echo(objComputer.Domain & "\" & objComputer.Name)
    Next

    ListAllComputers = lngCount
End Function
  

Requirements

Platforms: Requires Windows 2000 Server or later

Version: Requires MOM 2000 SP1 or later

See Also

MSFT_Computer Class