mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-04-03 05:56:25 +00:00
Launch main script using pwsh.exe when Get.ps1 is run in Powershell 7
This commit is contained in:
@@ -166,8 +166,16 @@ else {
|
||||
$windowStyle = "Normal"
|
||||
}
|
||||
|
||||
# Use powershell 7 to launch the script if the current environment is powershell 7, otherwise use powershell 5.1
|
||||
if ($PSVersionTable.PSVersion.Major -ge 7) {
|
||||
$powershellExe = "pwsh.exe"
|
||||
}
|
||||
else {
|
||||
$powershellExe = "powershell.exe"
|
||||
}
|
||||
|
||||
# Run Win11Debloat script with the provided arguments
|
||||
$debloatProcess = Start-Process powershell.exe -WindowStyle $windowStyle -PassThru -ArgumentList "-executionpolicy bypass -File $env:TEMP\Win11Debloat\Win11Debloat.ps1 $arguments" -Verb RunAs
|
||||
$debloatProcess = Start-Process $powershellExe -WindowStyle $windowStyle -PassThru -ArgumentList "-executionpolicy bypass -File $env:TEMP\Win11Debloat\Win11Debloat.ps1 $arguments" -Verb RunAs
|
||||
|
||||
# Wait for the process to finish before continuing
|
||||
if ($null -ne $debloatProcess) {
|
||||
|
||||
@@ -101,8 +101,6 @@ param (
|
||||
|
||||
|
||||
|
||||
Import-Module Microsoft.PowerShell.Security -SkipEditionCheck
|
||||
|
||||
# Define script-level variables & paths
|
||||
$script:Version = "2026.03.07"
|
||||
$script:AppsListFilePath = "$PSScriptRoot/Config/Apps.json"
|
||||
|
||||
Reference in New Issue
Block a user