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 Property | Search Operator | Value |
|---|---|---|
| gpoPermissions | opContainsopNotContains | GPMPermission |
| gpoEffectivePermissions | opContainsopNotContains | GPMPermission |
| gpoID | opEqualsopNotEquals | GUID |
| somLinks | opContains | GPMGPO |
| gpoDomain | opEquals | GPMDomain |
| backupMostRecent | opEquals | TRUE |
| gpoWMIFilter | opEquals | GPMWMIFilter |
| backupDomain | opEquals | String containing the domain name |
| gpoComputerExtensions | opContainsopNotContains | GUID |
| gpoUserExtensions | opContainsopNotContains | GUID |
| gpoDisplayName | opEqualsopContainsopNotContains | User-friendly GPO display name. |
| starterGPOPermissions | opContainsopNotContains | GPMPermission |
| starterGPOEffectivePermissions | opContainsopNotContains | GPMPermission |
| starterGPODisplayName | opEqualsopContainsopNotContains | User-friendly Starter GPO display name. |
| starterGPOID | opEqualsopNotEquals | GUID |
| starterGPODomain | opEquals | GPMDomain |
Requirements
|
Minimum supported client | Windows Vista |
|---|---|
|
Minimum supported server | Windows Server 2008 |
|
Redistributable | GPMC on Windows Server 2003 or Windows XP with SP1 |
|
Header |
|
|
IDL |
|
|
DLL |
|
|
IID |
IID_IGPMSearchCriteria is defined as D6F11C42-829B-48D4-83F5-3615B67DFC22 |
See also
Send comments about this topic to Microsoft
Build date: 2/3/2012
# 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$gposThis 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
- 2/4/2008
- Thomas Lee
- 1/18/2009
- Thomas Lee