> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell/powershell-commands/new-dssearchcriteria.md).

# New-DSSearchCriteria

### Synopsis

Create a search criterion to be used in the Search-DSEntry

### Syntax

#### \_\_AllParameterSets

```
New-DSSearchCriteria [-By] <SearchItemType> -Value <string> [-Match <SearchItemText>]
 [-CaseSensitive] [<CommonParameters>]
```

### Description

Create a search criterion to be used in the Search-DSEntry. The vaults to be searched are determined in the Search-DSEntry cmdlet. A criterion is determined at two fields: By, to indicate the field where the seach will be applied, and Value, the value whose type depend of the field. For a standard string value, the parameter Match indicates how to search is conducted. For date values, to use a custom interval, the value must be set to Custom and specified with the parameters After and Before. Search by ConnectionType or Description will ignore PAM vaults.

### Examples

#### Example 1

```powershell
PS C:\> New-DSSearchCriteria -By Name -Match StartsWith -Value ThePrefix | Search-DSEntry
```

Search all entries whose name starts with ThePrefix in all vaults, excluding the User vault and the PAM vaults.

#### Example 2

```powershell
PS C:\> $criteria = @();
        $criteria += New-DSSearchCriteria -By Username -Value AUsername;
        $criteria += New-DSSearchCriteria -By CreationDate -Value Last30Days;
        Search-DSEntry -InputObject $criteria -IncludePamVaults -IncludeVault @()
```

Search all PAM entries whose username contains AUsername created in the last 30 days. Only the PAM vaults will be searched.

### Parameters

#### -By

Field on which the expression will be applied

```yaml
Type: Devolutions.RemoteDesktopManager.SearchItemType
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

#### -CaseSensitive

Case sensitive search

```yaml
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

#### -Match

Condition the expression must respect. By default, the condition is 'Contains'.

```yaml
Type: Devolutions.RemoteDesktopManager.SearchItemText
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

#### -Value

Search date interval for the creation or the last update. For a custom value, use After and Before parameters. By default, it will be set to Last Week.

```yaml
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
```

#### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about\_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

### Notes

For more information, type "Get-Help New-DSSearchCriteria -detailed". For technical information, type "Get-Help New-DSSearchCriteria -full".


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devolutions.net/powershell/powershell-commands/new-dssearchcriteria.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
