MSFT_ComputerToComputerGroup.Group Property
Gets the MSFT_ComputerGroup object associated with a specific MSFT_Computer object.
MSFT_ComputerGroup MSFT_ComputerToComputerGroup.Group
Access
Read-only
Return Value
MSFT_ComputerGroup object
Examples
The following examples show the use of the MSFT_ComputerToComputerGroup class. The class supports association queries and, in most cases, you do not need to explicitly use its properties.
'*********************************************************************
' Routine: Function GetGroupsForComputer
' Purpose: Gets the computer groups the computer belongs to.
' Arguments: The server running MOM, the computer GUID.
' Returns: A collection of computer groups.
'
'**********************************************************************
Function GetGroupsForComputer(strMOMServer, strComputerGUID)
Dim objComputerGroups
Dim strQuery
strQuery = "ASSOCIATORS OF {MSFT_Computer.GUID=""" & strComputerGUID & """} WHERE ResultClass=MSFT_ComputerGroup"
Set objComputerGroups = GetObject("WinMgmts://" & strMOMServer & "\root\MOM").ExecQuery(strQuery)
Set GetGroupsForComputer = objComputerGroups
End Function
'*********************************************************************
' Routine: Function GetComputersForGroup
' Purpose: Gets the computers belonging to the specified group.
' Arguments: The server running MOM, the computer group GUID.
' Returns: A collection of computers.
'
'**********************************************************************
Function GetComputersForGroup(strMOMServer, strComputerGroupGUID)
Dim objComputersInGroup
Dim strQuery
strQuery = "ASSOCIATORS OF {MSFT_ComputerGroup.GUID=""" & strComputerGroupGUID & """} WHERE ResultClass=MSFT_Computer"
Set objComputersInGroup = GetObject("WinMgmts://" & strMOMServer & "\root\MOM").ExecQuery(strQuery)
Set GetComputersForGroup = objComputersInGroup
End Function
Requirements
Platforms: Requires Windows 2000 Server or later
Version: Requires MOM 2000 SP1 or later