Skip to content

Powershell Integration

NeilMacMullen edited this page Jan 20, 2024 · 11 revisions

To build the cmdlet.

  • dotnet publish pskql.csproj
  • cd to the publish folder
  • Import-Module .\pskql.dll

Running

ls | query-kql -query "data | project Name,Length"

Examples

get-process | Edit-Kql "project Name,Handles | summarize sum(Handles) by Name | take 10 | render piechart"

Create some folders named for the last 10 days

edit-kql "range N from 1d to 10d step 1d | extend D=now()-N | project T=format_datetime(D,'yyyy-MM-dd')" -NoQueryPrefix $true | % {New-Item $_.T -Type Directory }