Skip to content

Windows hook opens track-telemetry.ps1 with Notepad instead of executing it #241

Description

@Ettores88

Description

On Windows, the Azure Skills plugin PostToolUse hook appears to open track-telemetry.ps1 with Notepad instead of executing it through PowerShell.

Installed plugin version: 1.2.12

Affected file:

hooks/hooks.json

Current configuration:

{
  "type": "command",
  "windows": "${PLUGIN_ROOT}/hooks/scripts/track-telemetry.ps1",
  "powershell": "${PLUGIN_ROOT}/hooks/scripts/track-telemetry.ps1"
}

Expected behavior

The hook should execute the script using an explicit PowerShell command, for example:

powershell.exe -NoProfile -ExecutionPolicy Bypass -File "${PLUGIN_ROOT}/hooks/scripts/track-telemetry.ps1"

It should not rely on the Windows file association for .ps1 files.

Actual behavior

On Windows, the .ps1 file is opened in Notepad instead of being executed.
This can happen when the hook runner passes the script path directly to the Windows shell rather than invoking PowerShell.

Impact

  • Notepad opens unexpectedly after tool use.
  • The telemetry hook does not run as intended.
  • The behavior is confusing and may cause repeated unwanted windows.
  • The issue may affect other Windows users with .ps1 associated with a text
    editor.

Additional observation

The script itself supports disabling telemetry through:

$env:AZURE_MCP_COLLECT_TELEMETRY = "false"

However, the hook should still invoke PowerShell correctly when telemetry is enabled.

Suggested fix

Update the Windows hook entry to invoke PowerShell explicitly, or provide a small .cmd wrapper that calls PowerShell with -NoProfile and -File.

Please also consider avoiding an unpinned npx -y @azure/mcp@latest invocation from the hook, since it introduces non-reproducible runtime behavior and a supply-chain dependency.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions