Skip to content

Commit 146f11b

Browse files
SteveL-MSFTTravisEz13
authored andcommitted
Add env var to differentiate client/server telemetry in MSI (PowerShell#10612)
1 parent 83453d1 commit 146f11b

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

assets/Product.wxs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,15 @@
126126
<ComponentRef Id="ApplicationProgramsMenuShortcut"/>
127127
<ComponentRef Id="RegistryEntries"/>
128128
<ComponentRef Id="SetPath"/>
129+
<ComponentRef Id="Telemetry"/>
129130
<ComponentRef Id="ExplorerContextMenu"/>
130131
</Feature>
131132
<!-- We need to show EULA, and provide option to customize download location -->
132133
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
134+
<!-- Need to get the Windows product name from the registry -->
135+
<Property Id="WINDOWS_PRODUCT_NAME">
136+
<RegistrySearch Id="ProductName" Root="HKLM" Type="raw" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion" Name="ProductName" />
137+
</Property>
133138
<!-- Prerequisite check for Windows Universal C runtime -->
134139
<Property Id="UNIVERSAL_C_RUNTIME_INSTALLED" Secure="yes">
135140
<DirectorySearch Id="WindowsDirectory" Path="[WindowsFolder]">
@@ -157,16 +162,19 @@
157162
<Component Id="ProductVersionFolder" Guid="{e1a7f05e-0cd6-4227-80a8-e4fb311f045c}">
158163
<CreateFolder/>
159164
</Component>
165+
<Component Id="Telemetry" Guid="{80520f20-471d-4d08-adc8-bab637627b39}" KeyPath="yes">
166+
<Environment Id="PowerShellDistributionChannel" Action="create" Name="POWERSHELL_DISTRIBUTION_CHANNEL" Permanent="no" System="yes" Value="MSI:[WINDOWS_PRODUCT_NAME]"/>
167+
</Component>
160168
<Component Id="RegistryEntries" Guid="{402e52f7-baf8-489d-af21-f756a6ca3530}">
161-
<!-- create key for easy detection of a particular version of a powershell core package
162-
The upgrade code is used in the key because it will change when we allow SxS -->
163-
<RegistryKey Root="HKLM" Key="Software\Microsoft\PowerShellCore\InstalledVersions\$(var.UpgradeCode)" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
164-
<RegistryValue Type="string" Value="$(var.ProductSemanticVersion)" Name="SemanticVersion"/>
165-
</RegistryKey>
166-
<!-- register ourselves in application registry so can be started using just Win+R `pwsh.exe` -->
167-
<RegistryKey Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\pwsh.exe" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
168-
<RegistryValue Type="string" Value="[$(var.ProductDirectoryName)]pwsh.exe"/>
169-
</RegistryKey>
169+
<!-- create key for easy detection of a particular version of a powershell core package
170+
The upgrade code is used in the key because it will change when we allow SxS -->
171+
<RegistryKey Root="HKLM" Key="Software\Microsoft\PowerShellCore\InstalledVersions\$(var.UpgradeCode)" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
172+
<RegistryValue Type="string" Value="$(var.ProductSemanticVersion)" Name="SemanticVersion"/>
173+
</RegistryKey>
174+
<!-- register ourselves in application registry so can be started using just Win+R `pwsh.exe` -->
175+
<RegistryKey Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\pwsh.exe" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
176+
<RegistryValue Type="string" Value="[$(var.ProductDirectoryName)]pwsh.exe"/>
177+
</RegistryKey>
170178
</Component>
171179
<!-- add ourselves to %PATH% so pwsh.exe can be started from Windows PowerShell or cmd.exe -->
172180
<Component Id="SetPath" Guid="{9dbb7763-7baf-48e7-b025-3bdedcb0632f}" KeyPath="yes">

0 commit comments

Comments
 (0)