-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProduct.wxs
More file actions
174 lines (150 loc) · 8.34 KB
/
Product.wxs
File metadata and controls
174 lines (150 loc) · 8.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:ui="http://schemas.microsoft.com/wix/2006/ui">
<Product Id="*" Name="Powershell Context Tools" Language="1033" Version="1.0.0" Manufacturer="CodingCarson" UpgradeCode="{8a238da0-6085-4357-9417-b800d3c24dfe}">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" Description="Powershell Context Tools" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="Powershell Context Tools" Level="1">
<ComponentGroupRef Id="RegistryBaseGroup" />
<ComponentGroupRef Id="RegistryOnFolderClickGroup" />
<ComponentGroupRef Id="RegistryOnPs1FileClickGroup" />
<ComponentRef Id="UninstallShortcutComponent" />
</Feature>
<!-- Set the WIXUI_INSTALLDIR property (Fixes Error Code 2819) -->
<UI>
<UIRef Id="WixUI_InstallDir" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
</UI>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Powershell Context Tools" />
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="Powershell Context Tools"/>
</Directory>
</Directory>
</Fragment>
<Fragment>
<!-- Base Folder Context Menu -->
<ComponentGroup Id="RegistryBaseGroup">
<Component Id="PowershellBaseOptionsComponent" Directory="TARGETDIR">
<RegistryKey Root="HKCR" Key="Directory\Background\shell\PowershellContextTools" ForceDeleteOnUninstall="yes">
<RegistryValue Type="string" Name="MUIVerb" Value="Powershell Context Tools"/>
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\Background\shell\PowershellContextTools"/>
<RegistryValue Type="string" Name="Icon" Value="powershell.exe,0"/>
<RegistryKey Key="Shell">
<!-- Submenu -->
<!-- Open Directory As Administrator -->
<RegistryKey Key="runas">
<RegistryValue Type="string" Value="Open Directory (Admin)"/>
<RegistryValue Type="string" Name="HasLUAShield" Value=""/>
<RegistryValue Type="string" Name="Icon" Value="powershell.exe,0"/>
<RegistryKey Key="command">
<RegistryValue Type="string" Value=""C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe" -NoExit -Command Set-Location -literalPath "'%V'""/>
</RegistryKey>
</RegistryKey>
<!-- Open Directory -->
<RegistryKey Key="OpenDirectory">
<RegistryValue Type="string" Value="Open Directory"/>
<RegistryValue Type="string" Name="Icon" Value="powershell.exe,0"/>
<RegistryKey Key="command">
<RegistryValue Type="string" Value=""C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe" -NoExit -Command Set-Location -literalPath "'%V'""/>
</RegistryKey>
</RegistryKey>
<!-- Take Directory Ownership -->
<RegistryKey Key="TakeDirectoryOwnership">
<RegistryValue Type="string" Value="Take Directory Ownership"/>
<RegistryValue Type="string" Name="HasLUAShield" Value=""/>
<RegistryValue Type="string" Name="Icon" Value="explorer.exe,0"/>
<RegistryKey Key="command">
<RegistryValue Type="string" Value=""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoExit -Command Start-Process cmd -ArgumentList '/s,/c,takeown /a /r /d Y /f %V' -Verb RunAs"/>
</RegistryKey>
</RegistryKey>
<!-- End of Submenu -->
</RegistryKey>
</RegistryKey>
</Component>
</ComponentGroup>
<!-- On Folder Context Menu -->
<ComponentGroup Id="RegistryOnFolderClickGroup">
<Component Id="PowershellOnFolderOptionsComponent" Directory="TARGETDIR">
<RegistryKey Root="HKCR" Key="Directory\shell\PowershellContextTools" ForceDeleteOnUninstall="yes">
<RegistryValue Type="string" Name="MUIVerb" Value="Powershell Context Tools"/>
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\shell\PowershellContextTools"/>
<RegistryValue Type="string" Name="Icon" Value="powershell.exe,0"/>
<RegistryKey Key="Shell">
<!-- Submenu -->
<!-- Open Directory As Administrator -->
<RegistryKey Key="runas">
<RegistryValue Type="string" Value="Open Directory (Admin)"/>
<RegistryValue Type="string" Name="HasLUAShield" Value=""/>
<RegistryValue Type="string" Name="Icon" Value="powershell.exe,0"/>
<RegistryKey Key="command">
<RegistryValue Type="string" Value=""C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe" -NoExit -Command Set-Location -literalPath "'%V'""/>
</RegistryKey>
</RegistryKey>
<!-- Open Directory -->
<RegistryKey Key="OpenDirectory">
<RegistryValue Type="string" Value="Open Directory"/>
<RegistryValue Type="string" Name="Icon" Value="powershell.exe,0"/>
<RegistryKey Key="command">
<RegistryValue Type="string" Value=""C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe" -NoExit -Command Set-Location -literalPath "'%V'""/>
</RegistryKey>
</RegistryKey>
<!-- Take Directory Ownership -->
<RegistryKey Key="TakeDirectoryOwnership">
<RegistryValue Type="string" Value="Take Directory Ownership"/>
<RegistryValue Type="string" Name="HasLUAShield" Value=""/>
<RegistryValue Type="string" Name="Icon" Value="explorer.exe,0"/>
<RegistryKey Key="command">
<RegistryValue Type="string" Value=""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoExit -Command Start-Process cmd -ArgumentList '/s,/c,takeown /a /r /d Y /f %V' -Verb RunAs"/>
</RegistryKey>
</RegistryKey>
<!-- End of Submenu -->
</RegistryKey>
</RegistryKey>
</Component>
</ComponentGroup>
<!-- On .ps1 File Context Menu -->
<ComponentGroup Id="RegistryOnPs1FileClickGroup">
<Component Id="PowershellOnPs1FileOptionsComponent" Directory="TARGETDIR">
<RegistryKey Root="HKCR" Key="SystemFileAssociations\.ps1\Shell\PowershellContextTools" ForceDeleteOnUninstall="yes">
<RegistryValue Type="string" Name="MUIVerb" Value="Powershell Context Tools"/>
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="SystemFileAssociations\.ps1\Shell\PowershellContextTools"/>
<RegistryValue Type="string" Name="Icon" Value="powershell.exe,0"/>
<RegistryKey Key="Shell">
<!-- Submenu -->
<!-- Run Script -->
<RegistryKey Key="RunWithPowerShell">
<RegistryValue Type="string" Value="Run with PowerShell"/>
<RegistryValue Type="string" Name="Icon" Value="powershell.exe,0"/>
<RegistryKey Key="Command">
<RegistryValue Type="string" Value=""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-Command" "if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'""/>
</RegistryKey>
</RegistryKey>
<!-- Run Script as Administrator -->
<RegistryKey Key="runas">
<RegistryValue Type="string" Value="Run Script as Administrator"/>
<RegistryValue Type="string" Name="HasLUAShield" Value=""/>
<RegistryValue Type="string" Name="Icon" Value="powershell.exe,0"/>
<RegistryKey Key="Command">
<RegistryValue Type="string" Value=""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-Command" "if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'""/>
</RegistryKey>
</RegistryKey>
<!-- End of Submenu -->
</RegistryKey>
</RegistryKey>
</Component>
</ComponentGroup>
<!-- Uninstall Shortcut Component -->
<Component Id="UninstallShortcutComponent" Directory="ApplicationProgramsFolder" Guid="{01A1D750-F5E2-524C-BAAA-F450ABC49CAD}">
<CreateFolder />
<RemoveFolder Id="RemoveProgramMenuDir" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\Microsoft\PowershellContextTools" Name="installed" Type="integer" Value="1" KeyPath="yes" />
<RemoveRegistryKey Root="HKCR" Key="Software\Microsoft\PowershellContextTools" Action="removeOnUninstall"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
</Component>
</Fragment>
</Wix>