File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change
1
+ # ----------------------------------------------------------------------------------
2
+ #
3
+ # Copyright Microsoft Corporation
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+ # ----------------------------------------------------------------------------------
14
+
15
+ Get-ExecutionPolicy - List | Where-Object {$_.ExecutionPolicy -eq " Restricted" } |
16
+ % {
17
+ try
18
+ {
19
+ Set-ExecutionPolicy - Scope $_.Scope - ExecutionPolicy RemoteSigned - Force - ErrorAction " SilentlyContinue"
20
+ }
21
+ catch
22
+ {
23
+ # do not fail if execution policy cannot be set for this scope
24
+ }
25
+ }
Original file line number Diff line number Diff line change 93
93
</Component >
94
94
</DirectoryRef >
95
95
96
+ <DirectoryRef Id =" PowerShellFolder" >
97
+ <Component Id =" AzureSdkExecutionPolicyScript" Guid =" 3d0d589a-b34c-4c48-9a4c-df78f286c6a3" >
98
+ <File Id =" AzureSdkExecutionPolicyScriptFile" KeyPath =" yes" Source =" $(var.SolutionDir)\Setup\SetExecutionPolicy.ps1" />
99
+ </Component >
100
+ </DirectoryRef >
101
+
96
102
<DirectoryRef Id =" AzureSdkMenu" >
97
103
<Component Id =" AzureSdkShortcut" Guid =" A9B58A22-F746-451D-8840-F887D8014C3C" >
98
104
<Shortcut Id =" AzureSdkStartMenuShortcut"
110
116
<ComponentGroupRef Id =" azurecmdfiles" />
111
117
<ComponentRef Id =" PSModulePath.System" />
112
118
<ComponentRef Id =" AzureSdkShortcut" />
119
+ <ComponentRef Id =" AzureSdkExecutionPolicyScript" />
113
120
</Feature >
114
121
115
122
<Binary Id =" CustomActions" SourceFile =" $(var.caSourceDir)\Microsoft.WindowsAzure.Setup.CA.dll" />
116
123
<CustomAction Id =" UpdatePSShortcut" BinaryKey =" CustomActions" DllEntry =" UpdatePSShortcut" Execute =" deferred" Impersonate =" no" />
117
124
<CustomAction Id =" SetCustomActionDataValue" Return =" check" Property =" UpdatePSShortcut"
118
125
Value =" ShortcutPath=[AzureSdkMenu]Microsoft Azure PowerShell.lnk;DefaultShortcutPath=[ProgramMenuFolder]System Tools\Windows PowerShell.lnk" />
119
- <CustomAction Id =" SetExecutionPolicy" Property =" POWERSHELLEXE" ExeCommand =" -NoLogo -NoProfile -Command " Set- ExecutionPolicy RemoteSigned -Scope LocalMachine -Force " " Execute =" deferred" Impersonate =" no" Return =" check" />
126
+ <CustomAction Id =" SetExecutionPolicy" Property =" POWERSHELLEXE" ExeCommand =" -NoLogo -NoProfile -ExecutionPolicy Bypass -Command " .\ " [PowerShellFolder]\SetExecutionPolicy.ps1 " "" Execute =" deferred" Impersonate =" no" Return =" check" />
120
127
121
128
<InstallExecuteSequence >
122
129
<Custom Action =" SetCustomActionDataValue" After =" CreateShortcuts" >NOT Installed</Custom >
You can’t perform that action at this time.
0 commit comments