---
date_published: 2026-08-13
date_modified: 2026-08-13
canonical_url: https://metricshub.org/community-connectors/connectors/windowsfile.html
---

 [Supported Platforms](../supported-platforms.html)   [Connectors Directory](../connectors-directory.html)

# Windows Files Monitoring

## Description

This connector returns information of a specific file on Windows.

[community](tags/community.html) [system](tags/system.html) [windows](tags/windows.html)

[Source](https://github.com/metricshub/community-connectors/tree/main/src/main/connector/system/WindowsFile/WindowsFile.yaml)

## Target

Typical platform: **[Microsoft Windows](platforms/microsoft-windows.html)**

Operating system: **Microsoft Windows**

## Prerequisites

Leverages: **PowerShell and WMI**

Technology and protocols: **Commands**

Variables:

- `contentPattern`: Regular expression pattern to match file content for monitoring. (Error|Exception|Failure) (default: ``)
- `matchPath`: Regular expression pattern to match file names for monitoring. (C:\Users\Public\logs\*.log,C:\Program Files\MetricsHub\logs\*.log) (default: ``)

## Examples

### CLI

```batch
metricshub HOSTNAME -t win -c +WindowsFile --wmi -u USER
```

### metricshub.yaml

```yaml
resourceGroups:
  <RESOURCE_GROUP>:
    resources:
      <HOSTNAME-ID>:
        attributes:
          host.name: <HOSTNAME> # Change with actual host name
          host.type: win
        connectors: [ +WindowsFile ] # Optional, to load only this connector
        protocols:
          wmi:
            username: <USERNAME> # Change with actual credentials
            password: <PASSWORD> # Encrypted using metricshub-encrypt
        additionalConnectors:
          WindowsFile: # Unique ID. Use 'uses' if different from the original connector ID
            uses: WindowsFile # Optional - Original ID if not in key
            force: true # Optional (default: true); false for auto-detection only
            variables:
              contentPattern: <VALUE> # Replace with desired value.
              matchPath: <VALUE> # Replace with desired value.
```

## Connector Activation Criteria

The **Windows Files Monitoring** connector **must be selected manually**, and its status will be reported as OK if all the below criteria are met:

- The command below succeeds on the monitored host 
  
    - Command: `PowerShell.exe -ExecutionPolicy Bypass -Command "if ($env:OS -eq 'Windows_NT') { 'Windows' } else { 'Not Windows' }"`
    - Output contains: `Windows` (regex)

## Metrics

| Type | Collected Metrics | Specific Attributes |
| --- | --- | --- |
| **file** | - `system.file.atime` - `system.file.ctime` - `system.file.lines` - `system.file.mtime` - `system.file.size` | - `id` - `system.file.name` - `system.file.path` |
| **patternMatching** | - `system.file.keywords` | - `id` - `system.file.keyword` - `system.file.name` - `system.file.path` |
