Skip to content

Instantly share code, notes, and snippets.

@taddison
Created March 25, 2020 20:49
Show Gist options
  • Save taddison/1a4979186707dc6c2e2b7e433736c7c7 to your computer and use it in GitHub Desktop.
Save taddison/1a4979186707dc6c2e2b7e433736c7c7 to your computer and use it in GitHub Desktop.
DumpAllWindowsPerformanceCounters
Connect-AzAccount
$allPerfCounters = @()
$subscriptions = Get-AzSubscription
foreach ($subscription in $subscriptions) {
$subscription | Set-AzContext
$workspaces = Get-AzOperationalInsightsWorkspace
foreach ($workspace in $workspaces) {
$perfCounters = Get-AzOperationalInsightsDataSource -Kind WindowsPerformanceCounter -Workspace $workspace
foreach ($counter in $perfCounters) {
$allPerfCounters += [pscustomobject]@{
Subscription = $subscription.Name
ResourceGroup = $counter.ResourceGroupName
Workspace = $counter.WorkspaceName
ObjectName = $counter.Properties.ObjectName
InstanceName = $counter.Properties.InstanceName
CounterName = $counter.Properties.CounterName
Interval = $counter.Properties.IntervalSeconds
}
}
}
}
$allPerfCounters | ft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment