@@ -116,6 +116,11 @@ function Get-TelemetryLevelSource {
116116 process {
117117 $acceptedTelemetryLevels = " None" , " Basic" , " Full"
118118
119+ # Is it set interactively?
120+ if ($LabConfig.ContainsKey (" TelemetryLevelSource" )) {
121+ return $LabConfig.TelemetryLevelSource
122+ }
123+
119124 # LabConfig value has a priority
120125 if ($LabConfig.TelemetryLevel -and $LabConfig.TelemetryLevel -in $acceptedTelemetryLevels ) {
121126 return " LabConfig"
@@ -148,6 +153,8 @@ function Get-PcSystemType {
148153 }
149154}
150155
156+ $aiPropertyCache = @ {}
157+
151158function New-TelemetryEvent {
152159 param (
153160 [Parameter (Mandatory = $true )]
@@ -159,7 +166,7 @@ function New-TelemetryEvent {
159166
160167 process {
161168 if (-not $TelemetryInstrumentationKey ) {
162- WriteInfo " Instrumentation key is required in order to send telemetry data."
169+ WriteInfo " Instrumentation key is required to send telemetry data."
163170 return
164171 }
165172
@@ -203,6 +210,11 @@ function New-TelemetryEvent {
203210 $extraMetrics .' cpu.logical.count' = $hw.NumberOfLogicalProcessors
204211 $extraMetrics .' cpu.sockets.count' = $hw.NumberOfProcessors
205212
213+ if (-not $aiPropertyCache.ContainsKey (" cpu.model" )) {
214+ $aiPropertyCache [" cpu.model" ] = (Get-CimInstance " Win32_Processor" | Select-Object - First 1 ).Name
215+ }
216+ $extraProperties .' cpu.model' = $aiPropertyCache [" cpu.model" ]
217+
206218 # Disk
207219 $driveLetter = $ScriptRoot -Split " :" | Select-Object - First 1
208220 $volume = Get-Volume - DriveLetter $driveLetter
@@ -220,11 +232,13 @@ function New-TelemetryEvent {
220232 iKey = $TelemetryInstrumentationKey
221233 tags = @ {
222234 " ai.application.ver" = $wslabVersion
223- " ai.cloud.roleInstance " = Split-Path - Path $ScriptRoot - Leaf
235+ " ai.cloud.role " = Split-Path - Path $PSCommandPath - Leaf
224236 " ai.internal.sdkVersion" = ' wslab-telemetry:1.0.0'
225237 " ai.session.id" = $TelemetrySessionId
226238 " ai.device.locale" = (Get-WinsystemLocale ).Name
227- " ai.device.id" = $computerNameHash
239+ " ai.user.id" = (((Get-ItemProperty - Path HKLM:\SOFTWARE\Microsoft\Cryptography).MachineGuid) | Get-StringHash )
240+ " ai.device.id" = $computerNameHash
241+ " ai.device.type" = $extraProperties [" hw.type" ]
228242 " ai.device.os" = " "
229243 " ai.device.osVersion" = " "
230244 " ai.device.oemName" = " "
0 commit comments