Skip to content

Instantly share code, notes, and snippets.

@aaronparker
Created October 2, 2021 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aaronparker/0ac0d58e2dc780df4d7d3a9e82eb8dcc to your computer and use it in GitHub Desktop.
Save aaronparker/0ac0d58e2dc780df4d7d3a9e82eb8dcc to your computer and use it in GitHub Desktop.
Azure Workbook to display metrics gathered by Invoke-UserFolderStats
{
"version": "Notebook/1.0",
"items": [
{
"type": 1,
"content": {
"json": "# OneDrive Known Folder Move\n\nUser folder inventory for planning implementation and tracking of [Known Folder Move](https://docs.microsoft.com/en-us/onedrive/redirect-known-folders) with OneDrive for Business.\n\nUser folder details are gathered via Endpoint Analytics Proactive Remediations with [**Invoke-UserFolderStats.ps1**](https://github.com/Insentra/mem-foundations/blob/main/device-reporting/scripts/Invoke-UserFolderStats.ps1) and forwarded to Log Analytics via the [Azure Monitor HTTP Data Collector API](https://docs.microsoft.com/en-us/azure/azure-monitor/logs/data-collector-api).\n",
"style": "info"
},
"name": "Intro"
},
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"parameters": [
{
"id": "b4dc731c-643b-4d9b-9307-152339e986e4",
"version": "KqlParameterItem/1.0",
"name": "TimeSpan",
"label": "List stats for",
"type": 4,
"isRequired": true,
"value": {
"durationMs": 604800000
},
"typeSettings": {
"selectableValues": [
{
"durationMs": 3600000
},
{
"durationMs": 14400000
},
{
"durationMs": 43200000
},
{
"durationMs": 86400000
},
{
"durationMs": 172800000
},
{
"durationMs": 259200000
},
{
"durationMs": 604800000
},
{
"durationMs": 1209600000
},
{
"durationMs": 2419200000
},
{
"durationMs": 2592000000
}
]
},
"timeContext": {
"durationMs": 86400000
}
}
],
"style": "pills",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
"name": "Parameters"
},
{
"type": 1,
"content": {
"json": "## User Folder data to move to OneDrive\n\nMetrics shown here are data sizes in user's Documents, Pictures and Desktop folders that are yet to be moved to OneDrive. Implementing OneDrive Known Folder Move will redirect these locations into the OneDrive sync folder. The OneDrive client will then upload user data to OneDrive for Business."
},
"name": "InventoryIntro"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "UserFolders_CL\n| where TimeGenerated {TimeSpan:value}\n| where UserEmail_s != \"\"\n| summarize arg_max (TimeGenerated, *) by ComputerName_s\n| project DocumentsSize=DocumentsSizeMb_d\n| summarize sum(DocumentsSize)",
"size": 4,
"title": "Total Document folder size",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces",
"visualization": "tiles",
"tileSettings": {
"titleContent": {
"columnMatch": "sum_DocumentsSize",
"formatter": 1,
"numberFormat": {
"unit": 4,
"options": {
"style": "decimal",
"maximumFractionDigits": 2
}
}
},
"showBorder": false,
"sortOrderField": 2
}
},
"customWidth": "33",
"name": "TotalDocuments"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "UserFolders_CL\n| where TimeGenerated {TimeSpan:value}\n| where UserEmail_s != \"\"\n| summarize arg_max (TimeGenerated, *) by ComputerName_s\n| project PicturesSize=PicturesSizeMb_d\n| summarize sum(PicturesSize)",
"size": 4,
"title": "Total Pictures folder size",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces",
"visualization": "tiles",
"tileSettings": {
"titleContent": {
"columnMatch": "sum_PicturesSize",
"formatter": 1,
"numberFormat": {
"unit": 4,
"options": {
"style": "decimal",
"maximumFractionDigits": 2
}
}
},
"showBorder": false,
"sortOrderField": 2
}
},
"customWidth": "33",
"name": "TotalPictures"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "UserFolders_CL\n| where TimeGenerated {TimeSpan:value}\n| where UserEmail_s != \"\"\n| summarize arg_max (TimeGenerated, *) by ComputerName_s\n| project DesktopSize=DesktopSizeMb_d\n| summarize sum(DesktopSize)",
"size": 4,
"title": "Total Desktop folder size",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces",
"visualization": "tiles",
"tileSettings": {
"titleContent": {
"columnMatch": "sum_DesktopSize",
"formatter": 1,
"numberFormat": {
"unit": 4,
"options": {
"style": "decimal",
"maximumFractionDigits": 2
}
}
},
"showBorder": false,
"sortOrderField": 2
}
},
"customWidth": "33",
"name": "TotalDesktop"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "UserFolders_CL\n| where TimeGenerated {TimeSpan:value}\n| where UserEmail_s != \"\"\n| summarize arg_max (TimeGenerated, *) by UserEmail_s\n| project UserEmail_s, DocumentsSizeMb_d\n| order by DocumentsSizeMb_d desc\n| limit 5",
"size": 0,
"title": "Top 5 Documents folders",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces",
"visualization": "categoricalbar",
"tileSettings": {
"showBorder": false,
"titleContent": {
"columnMatch": "UserEmail_s",
"formatter": 1
},
"leftContent": {
"columnMatch": "DocumentsSize",
"formatter": 12,
"formatOptions": {
"palette": "auto"
},
"numberFormat": {
"unit": 17,
"options": {
"maximumSignificantDigits": 3,
"maximumFractionDigits": 2
}
}
}
},
"chartSettings": {
"xAxis": "UserEmail_s",
"yAxis": [
"DocumentsSizeMb_d"
],
"showMetrics": false,
"showLegend": true,
"ySettings": {
"numberFormatSettings": {
"unit": 4,
"options": {
"style": "decimal",
"useGrouping": true,
"maximumFractionDigits": 2
}
}
}
}
},
"customWidth": "33",
"name": "Top5Documents"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "UserFolders_CL\n| where TimeGenerated {TimeSpan:value}\n| where UserEmail_s != \"\"\n| summarize arg_max (TimeGenerated, *) by UserEmail_s\n| project UserEmail_s, PicturesSizeMb_d\n| order by PicturesSizeMb_d desc\n| limit 5",
"size": 0,
"title": "Top 5 Pictures folders",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces",
"visualization": "categoricalbar",
"tileSettings": {
"showBorder": false,
"titleContent": {
"columnMatch": "UserEmail_s",
"formatter": 1
},
"leftContent": {
"columnMatch": "DocumentsSize",
"formatter": 12,
"formatOptions": {
"palette": "auto"
},
"numberFormat": {
"unit": 17,
"options": {
"maximumSignificantDigits": 3,
"maximumFractionDigits": 2
}
}
}
},
"chartSettings": {
"xAxis": "UserEmail_s",
"showMetrics": false,
"showLegend": true,
"ySettings": {
"numberFormatSettings": {
"unit": 4,
"options": {
"style": "decimal",
"useGrouping": false,
"maximumFractionDigits": 2
}
}
}
}
},
"customWidth": "33",
"name": "Top5Pictures"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "UserFolders_CL\n| where TimeGenerated {TimeSpan:value}\n| where UserEmail_s != \"\"\n| summarize arg_max (TimeGenerated, *) by UserEmail_s\n| project UserEmail_s, DesktopSizeMb_d\n| order by DesktopSizeMb_d desc\n| limit 5",
"size": 0,
"title": "Top 5 Desktop folders",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces",
"visualization": "categoricalbar",
"tileSettings": {
"showBorder": false,
"titleContent": {
"columnMatch": "UserEmail_s",
"formatter": 1
},
"leftContent": {
"columnMatch": "DocumentsSize",
"formatter": 12,
"formatOptions": {
"palette": "auto"
},
"numberFormat": {
"unit": 17,
"options": {
"maximumSignificantDigits": 3,
"maximumFractionDigits": 2
}
}
}
},
"chartSettings": {
"xAxis": "UserEmail_s",
"yAxis": [
"DesktopSizeMb_d"
],
"showMetrics": false,
"showLegend": true,
"ySettings": {
"numberFormatSettings": {
"unit": 4,
"options": {
"style": "decimal",
"useGrouping": false,
"maximumFractionDigits": 2
}
}
}
}
},
"customWidth": "33",
"name": "Top5Desktop"
},
{
"type": 1,
"content": {
"json": "## Known Folder Move and User Folder status\n\nThis table shows the status of Known Folder Move for the default OneDrive for Business account configured for the currently logged on user.\n\nThe **KfmEnabled** column displays the current status of Known Folder Move. If this shows as a warning, Known Folder Move has not been enabled for that account. The **DesktopSize**, **DocumentsSize**, and **PicturesSize** columns list the directory size of the source user folder. This should ideally show 0MiB where folders have been redirected into OneDrive. Where folders have not been redirected, these columns will indicate the total amount of data that needs to be uploaded into OneDrive once Known Folder Move is enabled for that account.",
"style": "info"
},
"name": "StatusIntro"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "UserFolders_CL\n| where TimeGenerated {TimeSpan:value}\n| where UserEmail_s != \"\"\n| summarize arg_max (TimeGenerated, *) by ComputerName_s\n| project TimeGenerated, Computer=ComputerName_s, User=UserEmail_s, KfmEnabled=KfmEnabled_b, DesktopSize=DesktopSizeMb_d, DocumentsSize=DocumentsSizeMb_d, PicturesSize=PicturesSizeMb_d, ScriptElapsed=GatherElapsedSec_d",
"size": 3,
"title": "Known Folder Move status",
"showRefreshButton": true,
"showExportToExcel": true,
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces",
"visualization": "table",
"gridSettings": {
"formatters": [
{
"columnMatch": "KfmEnabled",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "true",
"representation": "success",
"text": ""
},
{
"operator": "==",
"thresholdValue": "false",
"representation": "2",
"text": ""
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "unknown",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "DesktopSize",
"formatter": 8,
"formatOptions": {
"palette": "greenRed"
},
"numberFormat": {
"unit": 4,
"options": {
"style": "decimal",
"maximumFractionDigits": 2
}
}
},
{
"columnMatch": "DocumentsSize",
"formatter": 8,
"formatOptions": {
"palette": "greenRed"
},
"numberFormat": {
"unit": 4,
"options": {
"style": "decimal",
"maximumFractionDigits": 2
}
}
},
{
"columnMatch": "PicturesSize",
"formatter": 8,
"formatOptions": {
"palette": "greenRed"
},
"numberFormat": {
"unit": 4,
"options": {
"style": "decimal",
"maximumFractionDigits": 2
}
}
},
{
"columnMatch": "ScriptElapsed",
"formatter": 0,
"numberFormat": {
"unit": 24,
"options": {
"style": "decimal"
}
}
}
],
"rowLimit": 1000,
"filter": true,
"sortBy": [
{
"itemKey": "$gen_heatmap_DocumentsSize_5",
"sortOrder": 2
}
]
},
"sortBy": [
{
"itemKey": "$gen_heatmap_DocumentsSize_5",
"sortOrder": 2
}
]
},
"name": "KnownFolderMoveStatus",
"styleSettings": {
"showBorder": true
}
}
],
"defaultResourceIds": [
"/subscriptions/63e8f660-f6a4-4ac5-ad4e-623268509f20/resourceGroups/rg-DeviceManagement-AustraliaSoutheast/providers/Microsoft.OperationalInsights/workspaces/log-DeviceReports-AustraliaEast"
],
"$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment