Click to Rate and Give Feedback
MSDN
MSDN Library
Group Policy
GPMC Interfaces
IGPM
 IGPM::GetDomain Method
Collapse All/Expand All Collapse All
IGPM::GetDomain Method

Creates and returns a GPMDomain object that corresponds to the specified domain.

The object allows you to do the following:
  • Create, query, and restore Group Policy objects (GPOs)
  • Search scope of management (SOM) objects
  • Search and retrieve Windows Management Instrumentation (WMI) filters

Syntax

C++
HRESULT GetDomain(
  [in]   BSTR bstrDomain,
  [in]   BSTR bstrDomainController,
  [in]   long lDCFlags,
  [out]  IGPMDomain **plIGPMDomain
);

Parameters

bstrDomain [in]

Name of the domain specified as a null-terminated string. This must be a full Domain Name System (DNS) name, such as contoso.com.

bstrDomainController [in]

If specified, the name of the domain controller to use with the domain. The name can be a DNS name or a NetBIOS name. Otherwise, the method uses the primary domain controller (PDC). Use a null-terminated string. For more information, see the lDCFlags parameter.

lDCFlags [in]

Flags to use to locate the domain controller for the domain. You can specify GPM_USE_ANYDC, GPM_USE_PDC, or GPM_DONOTUSE_W2KDC.

If this parameter is set to zero, and a bstrDomainController is specified, the method uses the specified bstrDomainController. Otherwise, the method uses the PDC.

plIGPMDomain [out]

Address of a pointer to the IGPMDomain interface.

Return Value

Returns S_OK if successful. Returns a failure code if an error occurs.
JScript
GetDomain(
  bstrDomainController,
  lDCFlags
)

Parameters

bstrDomainController [in]

If specified, the name of the domain controller to use with the domain. The name can be a DNS name or a NetBIOS name. Otherwise, the method uses the PDC. For more information, see the lDCFlags parameter. This parameter must pass an empty string ("") when a domain controller is not specified.

lDCFlags [in]

Flags to use to locate the domain controller for the domain. You can specify GPM_USE_ANYDC, GPM_USE_PDC, or GPM_DONOTUSE_W2KDC.

If this parameter is set to zero, and a bstrDomainController is specified, the method uses the specified bstrDomainController. Otherwise, the method uses the PDC.

Return Value

Returns a reference to a GPMDomain object.
VBScript
Function GetDomain( _
  ByVal bstrDomain, _
  ByVal bstrDomainController, _
  ByVal lDCFlags _
)

Parameters

bstrDomain [in]

Name of the domain specified as a string. This must be a full DNS name, such as, contoso.com.

bstrDomainController [in]

If specified, the name of the domain controller to use with the domain. The name can be a DNS name or a NetBIOS name. Otherwise, the method uses the PDC. For more information, see the lDCFlags parameter. This parameter must pass an empty string ("") when a domain controller is not specified.

lDCFlags [in]

Flags to use to locate the domain controller for the domain. You can specify GPM_USE_ANYDC, GPM_USE_PDC, or GPM_DONOTUSE_W2KDC.

If this parameter is set to zero, and a bstrDomainController is specified, the method uses the specified bstrDomainController. Otherwise, the method uses the PDC.

Return Value

Returns a reference to a GPMDomain object.

Remarks

This method does not allow you to search site SOMs. Call the IGPM::GetSitesContainer method to perform this type of query.

Requirements

Minimum supported clientWindows Vista
Minimum supported serverWindows Server 2008
RedistributableGPMC on Windows Server 2003 or Windows XP with SP1
HeaderGpmgmt.h
IDLGpmgmt.idl
DLLGpmgmt.dll
IIDIID_IGPM is defined as F5FAE809-3BD6-4DA9-A65E-17665B41D763

See Also

IGPM
IGPMDomain

Send comments about this topic to Microsoft

Build date: 3/9/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
GetDomain method using PowerShell      Thomas Lee   |   Edit   |   Show History
# Get-Domain.ps1
# Demonstrates the Get-Domain method of the IGPM object
# Thomas Lee - tfl@psp.co.uk
 
# Derive base object
 
$gpm=new-object -com gpmgmt.gpm
 
# Get constants
$k= $gpm.getconstants()
 
# Finally get domain object and display
$dom=$gpm.getdomain("gktrain.net","", $k.useanydc)
 
$dom | gm

On my Server 2008 system, this script produces the following output:

TypeName: System.__ComObject#{7ca6bb8b-f1eb-490a-938d-3c4e51c768e6}
  
    
Name                    MemberType Definition
---- ---------- ----------
CreateGPO Method IGPMGPO CreateGPO ()
CreateGPOFromStarterGPO Method IGPMGPO CreateGPOFromStarterGPO (IGPMStarterGPO)
CreateStarterGPO Method IGPMStarterGPO CreateStarterGPO ()
GetGPO Method IGPMGPO GetGPO (string)
GetSOM Method IGPMSOM GetSOM (string)
GetStarterGPO Method IGPMStarterGPO GetStarterGPO (string)
GetWMIFilter Method IGPMWMIFilter GetWMIFilter (string)
LoadStarterGPO Method IGPMResult LoadStarterGPO (string, bool, Variant, Variant)
RestoreGPO Method IGPMResult RestoreGPO (IGPMBackup, int, Variant, Variant)
RestoreStarterGPO Method IGPMResult RestoreStarterGPO (IGPMStarterGPOBackup, Variant, Variant)
SearchGPOs Method IGPMGPOCollection SearchGPOs (IGPMSearchCriteria)
SearchSOMs Method IGPMSOMCollection SearchSOMs (IGPMSearchCriteria)
SearchStarterGPOs Method IGPMStarterGPOCollection SearchStarterGPOs (IGPMSearchCriteria)
SearchWMIFilters Method IGPMWMIFilterCollection SearchWMIFilters (IGPMSearchCriteria)
Domain Property string Domain () {get}
DomainController Property string DomainController () {get}
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker