Install Powershell script using WiX

I have a signed PowerShell script that I want to deploy to the target machine through the WiX installer. Is it possible to provide script execution rights?

Regards, Forki

  • EDIT - It seems I need to call Powershell using --Command Set-ExecutionPolicy RemoteSigned, but I can't get it to work. I see a Powershell command prompt window, but it does not change the policy.
<Property Id="POWERSHELLEXE"><![CDATA[C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe]]></Property>

<CustomAction Id="AllowPS"
  Property="POWERSHELLEXE"
  ExeCommand="-NoLogo -NoProfile -Command Set-ExecutionPolicy RemoteSigned"
  Execute="deferred"
  Return="check"/>

<InstallExecuteSequence>
   ..
  <Custom Action="AllowPS" Before="InstallFinalize"/>
   ...
</InstallExecuteSequence>
+3
source share
3 answers

Group Policy is the best way to do this,

, , PowerShell.exe , , . -Force .

+3

PowerShell 2.0, PowerShell.exe -ExecutionPolicy. - script.

ExeCommand="-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -File <scrptpath>"
+2

I set ExecutionPolicy using group policies.

+1
source

Source: https://habr.com/ru/post/1735559/


All Articles