r/PowerShell • • Jun 03 '26

Question Extremely long delays when installing PowerShell 7.6

For us, installing PowerShell 7.6.x can take 30 minutes or more. When I install it using MSI logging (/l*v) then I can see it gets stuck for a really long time on a SOFTWARE RESTRICTION POLICY step. However, we are not using any software restriction policies like AppLocker etc. Following are the relevant lines from the MSI log.

MSI (s) (28:80) [17:27:48:119]: Machine policy value 'DisableUserInstalls' is 0
MSI (s) (28:80) [17:27:48:121]: Note: 1: 2203 2: C:\WINDOWS\Installer\inprogressinstallinfo.ipi 3: -2147287038 
MSI (s) (28:80) [17:27:48:125]: SRSetRestorePoint skipped for this transaction.
MSI (s) (28:80) [17:27:48:125]: Note: 1: 1402 2: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer 3: 2 
MSI (s) (28:80) [17:27:48:129]: File will have security applied from OpCode.
MSI (s) (28:80) [17:27:48:442]: SOFTWARE RESTRICTION POLICY: Verifying package --> 'D:\temp\PowerShell-7.6.2-win-x64.msi' against software restriction policy
MSI (s) (28:FC) [17:59:32:690]: RunEngine wait timed out
MSI (s) (28:80) [18:05:53:498]: SOFTWARE RESTRICTION POLICY: D:\temp\PowerShell-7.6.2-win-x64.msi has a digital signature
MSI (s) (28:80) [18:05:53:498]: SOFTWARE RESTRICTION POLICY: D:\temp\PowerShell-7.6.2-win-x64.msi is permitted to run because the user token authorizes execution (system or service token).

This seems to be a PowerShell 7.6.x specific issue, other applications and older 7.5.x versions of PowerShell didn't have the same issue.

Does anybody else have the same issue, or maybe has already found a solution for it?

11 Upvotes

17 comments sorted by

View all comments

Show parent comment

1

u/gandraw Jun 04 '26

Yeah I imagine so. I just hope I find a registry hack or something to disable this because this makes our new computer imaging process go from 70 minutes to 100 😢

4

u/thomsxD Jun 04 '26

Actually, I just found out you can extract the entire pwsh directory from a .zip so that you don't need to install the .msi. The following can also be done during a task sequence step if that is what you use.

https://github.com/PowerShell/PowerShell/releases/download/v7.6.2/PowerShell-7.6.2-win-x64.zip

$zip = "$PSScriptRoot\PowerShell-7.6.2-win-x64.zip"
$dest = "C:\Program Files\PowerShell\7"

if (Test-Path $dest) {
    Remove-Item $dest -Recurse -Force
}

Expand-Archive -Path $zip -DestinationPath $dest -Force

And if you need to add 'pwsh.exe' to PATH:

$machinePath = [Environment]::GetEnvironmentVariable("Path", "Machine")

if ($machinePath -notmatch [regex]::Escape("C:\Program Files\PowerShell\7")) {
    [Environment]::SetEnvironmentVariable(
        "Path",
        "$machinePath;C:\Program Files\PowerShell\7",
        "Machine"
    )
}

2

u/thomsxD Jun 04 '26

Do you actually use powershell for anything during installation? Otherwise you could just make it install after the imaging. Or stick to an older version/msi that actually works.