This topic has not yet been rated - Rate this topic

IGPMSearchCriteria::Add method

Applies to: desktop apps only

Adds a criterion for search operations.

Syntax


HRESULT Add(
  [in]  GPMSearchProperty searchProperty,
  [in]  GPMSearchOperation searchOperation,
  [in]  VARIANT varValue
);

Parameters

searchProperty [in]

The search property to evaluate. For a valid combination of search properties, search operations, and values, see the Remarks section.

searchOperation [in]

The operation to use to evaluate searchProperty using the value specified by varValue.

varValue [in]

The value to evaluate searchProperty against.

Return value

JScript

Returns S_OK if successful. Returns a failure code if an error occurs.

VB

Returns S_OK if successful. Returns a failure code if an error occurs.

Remarks

Following is a table that contains the valid combinations for the searchProperty, searchOperation, and varValue parameters.

Note  Multiple calls to IGPMSearchCriteria::Add will result in a logical And operation of search criteria. This call does not support the Or logical operation functionality. Also, you can perform a Not of an individual criteria, but cannot perform a Not of a search result.

Search PropertySearch OperatorValue
gpoPermissionsopContainsopNotContainsGPMPermission
gpoEffectivePermissionsopContainsopNotContainsGPMPermission
gpoIDopEqualsopNotEqualsGUID
somLinksopContainsGPMGPO
gpoDomainopEqualsGPMDomain
backupMostRecentopEqualsTRUE
gpoWMIFilteropEqualsGPMWMIFilter
backupDomainopEqualsString containing the domain name
gpoComputerExtensionsopContainsopNotContainsGUID
gpoUserExtensionsopContainsopNotContainsGUID
gpoDisplayNameopEqualsopContainsopNotContainsUser-friendly GPO display name.
starterGPOPermissionsopContainsopNotContainsGPMPermission
starterGPOEffectivePermissionsopContainsopNotContainsGPMPermission
starterGPODisplayNameopEqualsopContainsopNotContainsUser-friendly Starter GPO display name.
starterGPOIDopEqualsopNotEqualsGUID
starterGPODomainopEqualsGPMDomain

 

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Redistributable

GPMC on Windows Server 2003 or Windows XP with SP1

Header

Gpmgmt.h

IDL

Gpmgmt.idl

DLL

Gpmgmt.dll

IID

IID_IGPMSearchCriteria is defined as D6F11C42-829B-48D4-83F5-3615B67DFC22

See also

IGPM
IGPMDomain

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Add method using Powershell
# Search-GPO.ps1
# Sample showing how to build and execute a simple search critera using PowerShell
# Thomas Lee - tfl@psp.co.uk
  
# First, get root, domain and constants objects
$gpm=new-object -com gpmgmt.gpm
$dom=$gpm.getdomain("gktrain.net", "","")
$k = $gpm.getconstants()
    
# Now create SC
$sc=$gpm.CreateSearchCriteria()
      
# Here add a criteria to search for a display name == "GPO1" and search for it
$sc.add($k.SearchPropertyGPODisplayName,$k.SearchOpEquals, "GPO1")
$gpos = $dom.SearchGPOs($sc
        
# Display result
$gpos
          
This script produces the following output on a test system:
            
              
                
                  
DisplayName                 : GPO1
Path : cn={7B10D74C-0329-42DE-BB34-8D0140235453},cn=policies,cn=system,DC=gktrain,DC=net
ID : {7B10D74C-0329-42DE-BB34-8D0140235453}
DomainName : gktrain.net
CreationTime : 03/02/2008 05:32:42
ModificationTime : 03/02/2008 05:33:26
UserDSVersionNumber : 1
ComputerDSVersionNumber : 1
UserSysvolVersionNumber : 1
ComputerSysvolVersionNumber : 1
Description : Test GPO created with PowerShel