The DASCLI testpattern command evaluates whether a given pattern matches a name.

Authentication is required to use this command.

Parameters

dascli testpattern rule_pattern literal_string 

rule_pattern
Custom rule formatted condition to be evaluated. Patterns can contain user-specified macros and will be expanded in the context of the user that ran dascli.exe.
literal_string
Full path to test the pattern against. The path is normalized prior to being compared with the expanded pattern.

Output

The expanded pattern is the expansion for the pattern after the evaluation of all conditions inside the pattern. For example, the command dascli testpattern "<System>\*.exe" c:\windows\system32\calc.exe results in the expanded pattern \\?\globalroot\device\harddiskvolume2\windows\system32\*.exe.

The normalized file name is the file name determined from the expanded pattern. For the above example, the normalized file name is: \\?\globalroot\device\harddiskvolume2\windows\system32\calc.exe.

The evaluation results in a match or no match, or an error may have occurred.
  • A match is determined when the rule pattern expanded correctly and the file name exists on this agent.
  • No match is determined when the rule pattern expanded correctly but the specified normalize path did not match the expanded rule pattern.
  • An error is determined when there was a syntactical error evaluating the pattern or the file name. 
  • An error is determined when a pattern fails to expand. One of the conditions in the rule pattern failed to expand. The error message helps to determine why the pattern did not expand.

For example, a match is determined for the command dascli testpattern "<System>\*.bat" c:\windows\system32\calc.exe. The expanded pattern is \\?\globalroot\device\harddiskvolume2\windows\system32\*.bat and the normalized file name is \\?\globalroot\device\harddiskvolume2\windows\system32\calc.exe.

For example, no match is determined for the command dascli testpattern "<OnlyIf:Hostname:Foo><System>\*.exe" c:\ windows\system32\calc.exe. The error message Failed to expand pattern: HostName is shown.