mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 10:32:35 -05:00
Compare commits
6 Commits
27a97e4650
...
25.03.05
Author | SHA1 | Date | |
---|---|---|---|
52de4690ab | |||
ef97a8da24 | |||
18a7f17a0b | |||
5a8cf5deb6 | |||
e4b2a38372 | |||
94c5d89430 |
6
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
6
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
@ -7,10 +7,10 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
# 🐞 **Issue Report**
|
# 🐞 **Issue Report**
|
||||||
Thank you for taking the time to report an issue! Please provide as much detail as possible to help us address the problem efficiently.
|
Thank you for taking the time to report an issue! Please provide as much detail as possible to help us address the problem efficiently.
|
||||||
|
|
||||||
## ⚠️ **IMPORTANT**
|
## ⚠️ **IMPORTANT**
|
||||||
- 🛠️ **Supported environments only:** We only support Windows 11. Custom ISOs that are not made using Microwin are not supported.
|
- 🛠️ **Supported environments only:** We only support Windows 11. Custom ISOs that are not made using Microwin are not supported.
|
||||||
- 💡 For general questions, use the [Discussions section](https://github.com/Christitustech/winutil/discussions) or join our Community-driven [Discord Server](https://discord.gg/RUbZUZyByQ).
|
- 💡 For general questions, use the [Discussions section](https://github.com/Christitustech/winutil/discussions) or join our Community-driven [Discord Server](https://discord.gg/RUbZUZyByQ).
|
||||||
|
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
|
4
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
4
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
@ -9,7 +9,7 @@ body:
|
|||||||
# ✨ **Feature request**
|
# ✨ **Feature request**
|
||||||
Thank you for taking the time to suggest a feature! Please provide as much detail as possible to help us understand and evaluate your request.
|
Thank you for taking the time to suggest a feature! Please provide as much detail as possible to help us understand and evaluate your request.
|
||||||
|
|
||||||
## ⚠️ **IMPORTANT**
|
## ⚠️ **IMPORTANT**
|
||||||
- 🛠️ **Supported environments only:** We only support Windows 11.
|
- 🛠️ **Supported environments only:** We only support Windows 11.
|
||||||
- 💡 For general questions, use the [Discussions section](https://github.com/Christitustech/winutil/discussions) or join our Community-driven [Discord Server](https://discord.gg/RUbZUZyByQ).
|
- 💡 For general questions, use the [Discussions section](https://github.com/Christitustech/winutil/discussions) or join our Community-driven [Discord Server](https://discord.gg/RUbZUZyByQ).
|
||||||
|
|
||||||
@ -54,4 +54,4 @@ body:
|
|||||||
label: 🖼️ Additional context
|
label: 🖼️ Additional context
|
||||||
placeholder: "Include screenshots, code blocks (use triple backticks ```), or any other relevant information."
|
placeholder: "Include screenshots, code blocks (use triple backticks ```), or any other relevant information."
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# Import the function (adjust the path according to your setup)
|
# Import the function (adjust the path according to your setup)
|
||||||
. "./functions/private/Get-WinUtilWingetLatest.ps1"
|
. "./functions/private/Install-WinUtilWinget.ps1"
|
||||||
|
. "./functions/private/Test-WinUtilPackageManager.ps1"
|
||||||
|
|
||||||
# Set up Information stream to be visible
|
# Set up Information stream to be visible
|
||||||
$InformationPreference = "Continue"
|
$InformationPreference = "Continue"
|
||||||
@ -7,20 +8,7 @@ $InformationPreference = "Continue"
|
|||||||
Write-Host "Starting Winget installation test..." -ForegroundColor Cyan
|
Write-Host "Starting Winget installation test..." -ForegroundColor Cyan
|
||||||
|
|
||||||
try {
|
try {
|
||||||
# Test the function with verbose output
|
Install-WinUtilWinget
|
||||||
Write-Host "Attempting to run Get-WinUtilWingetLatest..." -ForegroundColor Cyan
|
|
||||||
Get-WinUtilWingetLatest -Verbose
|
|
||||||
|
|
||||||
# Verify Winget is working
|
|
||||||
if (Get-Command winget -ErrorAction SilentlyContinue) {
|
|
||||||
Write-Host "Success! Winget is installed and accessible." -ForegroundColor Green
|
|
||||||
|
|
||||||
# Display Winget version
|
|
||||||
Write-Host "`nWinget version:" -ForegroundColor Cyan
|
|
||||||
winget --version
|
|
||||||
} else {
|
|
||||||
Write-Host "Warning: Winget is installed but not accessible in the current session. You may need to restart your terminal." -ForegroundColor Yellow
|
|
||||||
}
|
|
||||||
} catch {
|
} catch {
|
||||||
Write-Host "Error occurred during testing: $($_.Exception.Message)" -ForegroundColor Red
|
Write-Host "Error occurred during testing: $($_.Exception.Message)" -ForegroundColor Red
|
||||||
Write-Host "Stack Trace:" -ForegroundColor Red
|
Write-Host "Stack Trace:" -ForegroundColor Red
|
||||||
|
@ -2934,5 +2934,13 @@
|
|||||||
"description": "Fork - a fast and friendly git client.",
|
"description": "Fork - a fast and friendly git client.",
|
||||||
"link": "https://git-fork.com/",
|
"link": "https://git-fork.com/",
|
||||||
"winget": "Fork.Fork"
|
"winget": "Fork.Fork"
|
||||||
|
},
|
||||||
|
"ZenBrowser": {
|
||||||
|
"category": "Browsers",
|
||||||
|
"choco": "na",
|
||||||
|
"content": "Zen Browser",
|
||||||
|
"description": "The modern, privacy-focused, performance-driven browser built on Firefox",
|
||||||
|
"link": "https://zen-browser.app/",
|
||||||
|
"winget": "Zen-Team.Zen-Browser"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -423,26 +423,6 @@
|
|||||||
"StartupType": "Automatic",
|
"StartupType": "Automatic",
|
||||||
"OriginalType": "Automatic"
|
"OriginalType": "Automatic"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Name": "DoSvc",
|
|
||||||
"StartupType": "AutomaticDelayedStart",
|
|
||||||
"OriginalType": "Automatic"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "DsSvc",
|
|
||||||
"StartupType": "Manual",
|
|
||||||
"OriginalType": "Manual"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "DsmSvc",
|
|
||||||
"StartupType": "Manual",
|
|
||||||
"OriginalType": "Manual"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "DusmSvc",
|
|
||||||
"StartupType": "Automatic",
|
|
||||||
"OriginalType": "Automatic"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Name": "EFS",
|
"Name": "EFS",
|
||||||
"StartupType": "Manual",
|
"StartupType": "Manual",
|
||||||
@ -898,11 +878,6 @@
|
|||||||
"StartupType": "Manual",
|
"StartupType": "Manual",
|
||||||
"OriginalType": "Manual"
|
"OriginalType": "Manual"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Name": "SgrmBroker",
|
|
||||||
"StartupType": "Automatic",
|
|
||||||
"OriginalType": "Automatic"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Name": "SharedAccess",
|
"Name": "SharedAccess",
|
||||||
"StartupType": "Manual",
|
"StartupType": "Manual",
|
||||||
@ -933,11 +908,6 @@
|
|||||||
"StartupType": "Manual",
|
"StartupType": "Manual",
|
||||||
"OriginalType": "Manual"
|
"OriginalType": "Manual"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Name": "StateRepository",
|
|
||||||
"StartupType": "Manual",
|
|
||||||
"OriginalType": "Automatic"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Name": "StiSvc",
|
"Name": "StiSvc",
|
||||||
"StartupType": "Manual",
|
"StartupType": "Manual",
|
||||||
@ -973,11 +943,6 @@
|
|||||||
"StartupType": "Automatic",
|
"StartupType": "Automatic",
|
||||||
"OriginalType": "Automatic"
|
"OriginalType": "Automatic"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Name": "TextInputManagementService",
|
|
||||||
"StartupType": "Manual",
|
|
||||||
"OriginalType": "Automatic"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Name": "Themes",
|
"Name": "Themes",
|
||||||
"StartupType": "Automatic",
|
"StartupType": "Automatic",
|
||||||
|
@ -1,104 +0,0 @@
|
|||||||
function Get-WinUtilWingetLatest {
|
|
||||||
[CmdletBinding()]
|
|
||||||
param()
|
|
||||||
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Uses GitHub API to check for the latest release of Winget.
|
|
||||||
.DESCRIPTION
|
|
||||||
This function first attempts to update WinGet using winget itself, then falls back to manual installation if needed.
|
|
||||||
#>
|
|
||||||
$ProgressPreference = "SilentlyContinue"
|
|
||||||
$InformationPreference = 'Continue'
|
|
||||||
|
|
||||||
try {
|
|
||||||
$wingetCmd = Get-Command winget -ErrorAction Stop
|
|
||||||
Write-Information "Attempting to update WinGet using WinGet..."
|
|
||||||
$result = Start-Process -FilePath "`"$($wingetCmd.Source)`"" -ArgumentList "install -e --accept-source-agreements --accept-package-agreements Microsoft.AppInstaller" -Wait -NoNewWindow -PassThru
|
|
||||||
if ($result.ExitCode -ne 0) {
|
|
||||||
throw "WinGet update failed with exit code: $($result.ExitCode)"
|
|
||||||
}
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Information "WinGet not found or update failed. Attempting to install from Microsoft Store..."
|
|
||||||
try {
|
|
||||||
# Try to close any running WinGet processes
|
|
||||||
Get-Process -Name "DesktopAppInstaller", "winget" -ErrorAction SilentlyContinue | ForEach-Object {
|
|
||||||
Write-Information "Stopping running WinGet process..."
|
|
||||||
$_.Kill()
|
|
||||||
Start-Sleep -Seconds 2
|
|
||||||
}
|
|
||||||
|
|
||||||
# Try to load Windows Runtime assemblies more reliably
|
|
||||||
$null = [System.Runtime.WindowsRuntime.WindowsRuntimeSystemExtensions]
|
|
||||||
Add-Type -AssemblyName System.Runtime.WindowsRuntime
|
|
||||||
|
|
||||||
# Load required assemblies from Windows SDK
|
|
||||||
$null = @(
|
|
||||||
[Windows.Management.Deployment.PackageManager, Windows.Management.Deployment, ContentType = WindowsRuntime]
|
|
||||||
[Windows.Foundation.Uri, Windows.Foundation, ContentType = WindowsRuntime]
|
|
||||||
[Windows.Management.Deployment.DeploymentOptions, Windows.Management.Deployment, ContentType = WindowsRuntime]
|
|
||||||
)
|
|
||||||
|
|
||||||
# Initialize PackageManager
|
|
||||||
$packageManager = New-Object Windows.Management.Deployment.PackageManager
|
|
||||||
|
|
||||||
# Rest of the Microsoft Store installation logic
|
|
||||||
$appxPackage = "https://aka.ms/getwinget"
|
|
||||||
$uri = New-Object Windows.Foundation.Uri($appxPackage)
|
|
||||||
$deploymentOperation = $packageManager.AddPackageAsync($uri, $null, "Add")
|
|
||||||
|
|
||||||
# Add timeout check for deployment operation
|
|
||||||
$timeout = 300
|
|
||||||
$timer = [System.Diagnostics.Stopwatch]::StartNew()
|
|
||||||
|
|
||||||
while ($deploymentOperation.Status -eq 0) {
|
|
||||||
if ($timer.Elapsed.TotalSeconds -gt $timeout) {
|
|
||||||
throw "Installation timed out after $timeout seconds"
|
|
||||||
}
|
|
||||||
Start-Sleep -Milliseconds 100
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($deploymentOperation.Status -eq 1) {
|
|
||||||
Write-Information "Successfully installed WinGet from Microsoft Store"
|
|
||||||
return $true
|
|
||||||
} else {
|
|
||||||
throw "Installation failed with status: $($deploymentOperation.Status)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch [System.Management.Automation.RuntimeException] {
|
|
||||||
Write-Information "Windows Runtime components not available. Attempting manual download..."
|
|
||||||
try {
|
|
||||||
# Try to close any running WinGet processes
|
|
||||||
Get-Process -Name "DesktopAppInstaller", "winget" -ErrorAction SilentlyContinue | ForEach-Object {
|
|
||||||
Write-Information "Stopping running WinGet process..."
|
|
||||||
$_.Kill()
|
|
||||||
Start-Sleep -Seconds 2
|
|
||||||
}
|
|
||||||
|
|
||||||
# Fallback to direct download from GitHub
|
|
||||||
$apiUrl = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
|
|
||||||
$release = Invoke-RestMethod -Uri $apiUrl
|
|
||||||
$msixBundleUrl = ($release.assets | Where-Object { $_.name -like "*.msixbundle" }).browser_download_url
|
|
||||||
|
|
||||||
$tempFile = Join-Path $env:TEMP "Microsoft.DesktopAppInstaller.msixbundle"
|
|
||||||
Invoke-WebRequest -Uri $msixBundleUrl -OutFile $tempFile
|
|
||||||
|
|
||||||
Add-AppxPackage -Path $tempFile -ErrorAction Stop
|
|
||||||
Remove-Item $tempFile -Force
|
|
||||||
|
|
||||||
Write-Information "Successfully installed WinGet from GitHub release"
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Error "Failed to install WinGet: $_"
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Error "Failed to install WinGet: $_"
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -33,18 +33,44 @@ function Install-WinUtilWinget {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install Winget via GitHub method.
|
Write-Host "Attempting to install/update Winget`r"
|
||||||
# Used part of my own script with some modification: ruxunderscore/windows-initialization
|
try {
|
||||||
Write-Host "Downloading Winget and License File`r"
|
$wingetCmd = Get-Command winget -ErrorAction Stop
|
||||||
Get-WinUtilWingetLatest
|
Write-Information "Attempting to update WinGet using WinGet..."
|
||||||
Write-Host "Enabling NuGet and Module..."
|
$result = Start-Process -FilePath "`"$($wingetCmd.Source)`"" -ArgumentList "install -e --accept-source-agreements --accept-package-agreements Microsoft.AppInstaller" -Wait -NoNewWindow -PassThru
|
||||||
Install-PackageProvider -Name NuGet -Force
|
if ($result.ExitCode -ne 0) {
|
||||||
Install-Module -Name Microsoft.WinGet.Client -Force
|
throw "WinGet update failed with exit code: $($result.ExitCode)"
|
||||||
# Winget only needs a refresh of the environment variables to be used.
|
}
|
||||||
Write-Output "Refreshing Environment Variables...`n"
|
Write-Output "Refreshing Environment Variables...`n"
|
||||||
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
||||||
} catch {
|
return
|
||||||
Write-Error "Failed to install Winget: $($_.Exception.Message)"
|
} catch {
|
||||||
}
|
Write-Information "WinGet not found or update failed. Attempting to install from Microsoft Store..."
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Write-Host "Attempting to repair WinGet using Repair-WinGetPackageManager..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
# Check if Windows version supports Repair-WinGetPackageManager (24H2 and above)
|
||||||
|
if ([System.Environment]::OSVersion.Version.Build -ge 26100) {
|
||||||
|
Repair-WinGetPackageManager -Force -Latest -Verbose
|
||||||
|
# Verify if repair was successful
|
||||||
|
$wingetCmd = Get-Command winget -ErrorAction Stop
|
||||||
|
Write-Host "WinGet repair successful!" -ForegroundColor Green
|
||||||
|
} else {
|
||||||
|
Write-Host "Repair-WinGetPackageManager is only available on Windows 24H2 and above. Your version doesn't support this method." -ForegroundColor Yellow
|
||||||
|
throw "Windows version not supported for repair method"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output "Refreshing Environment Variables...`n"
|
||||||
|
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
||||||
|
return
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
Write-Error "All installation methods failed. Unable to install WinGet."
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Error "An error occurred during WinGet installation: $_"
|
||||||
|
throw
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,14 +23,22 @@ function Test-WinUtilPackageManager {
|
|||||||
# Check if Winget is available while getting it's Version if it's available
|
# Check if Winget is available while getting it's Version if it's available
|
||||||
$wingetExists = $true
|
$wingetExists = $true
|
||||||
try {
|
try {
|
||||||
$wingetVersionFull = winget --version
|
$wingetInfo = winget --info
|
||||||
|
# Extract the package version from the output
|
||||||
|
$wingetVersionFull = ($wingetInfo | Select-String -Pattern 'Microsoft\.DesktopAppInstaller v\d+\.\d+\.\d+\.\d+').Matches.Value
|
||||||
|
if ($wingetVersionFull) {
|
||||||
|
$wingetVersionFull = $wingetVersionFull.Split(' ')[-1].TrimStart('v')
|
||||||
|
} else {
|
||||||
|
# Fallback in case the pattern isn't found
|
||||||
|
$wingetVersionFull = ($wingetInfo | Select-String -Pattern 'Package Manager v\d+\.\d+\.\d+').Matches.Value.Split(' ')[-1]
|
||||||
|
}
|
||||||
} catch [System.Management.Automation.CommandNotFoundException], [System.Management.Automation.ApplicationFailedException] {
|
} catch [System.Management.Automation.CommandNotFoundException], [System.Management.Automation.ApplicationFailedException] {
|
||||||
Write-Warning "Winget was not found due to un-availablity reasons"
|
Write-Warning "Winget was not found due to un-availablity reasons"
|
||||||
$wingetExists = $false
|
$wingetExists = $false
|
||||||
} catch {
|
} catch {
|
||||||
Write-Warning "Winget was not found due to un-known reasons, The Stack Trace is:`n$($psitem.Exception.StackTrace)"
|
Write-Warning "Winget was not found due to un-known reasons, The Stack Trace is:`n$($psitem.Exception.StackTrace)"
|
||||||
$wingetExists = $false
|
$wingetExists = $false
|
||||||
}
|
}
|
||||||
|
|
||||||
# If Winget is available, Parse it's Version and give proper information to Terminal Output.
|
# If Winget is available, Parse it's Version and give proper information to Terminal Output.
|
||||||
# If it isn't available, the return of this funtion will be "not-installed", indicating that
|
# If it isn't available, the return of this funtion will be "not-installed", indicating that
|
||||||
@ -48,13 +56,14 @@ function Test-WinUtilPackageManager {
|
|||||||
# Check if Winget's Version is too old.
|
# Check if Winget's Version is too old.
|
||||||
$wingetCurrentVersion = [System.Version]::Parse($wingetVersion.Trim('v'))
|
$wingetCurrentVersion = [System.Version]::Parse($wingetVersion.Trim('v'))
|
||||||
# Grabs the latest release of Winget from the Github API for version check process.
|
# Grabs the latest release of Winget from the Github API for version check process.
|
||||||
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/Winget-cli/releases/latest" -Method Get -ErrorAction Stop
|
$response = winget search -e Microsoft.AppInstaller --accept-source-agreements
|
||||||
$wingetLatestVersion = [System.Version]::Parse(($response.tag_name).Trim('v')) #Stores version number of latest release.
|
$wingetLatestVersion = ($response | Select-String -Pattern '\d+\.\d+\.\d+\.\d+').Matches.Value
|
||||||
$wingetOutdated = $wingetCurrentVersion -lt $wingetLatestVersion
|
Write-Host "Latest Search Version: $wingetLatestVersion" -ForegroundColor White
|
||||||
|
Write-Host "Current Installed Version: $wingetCurrentVersion" -ForegroundColor White
|
||||||
|
$wingetOutdated = $wingetCurrentVersion -lt [System.Version]::Parse($wingetLatestVersion)
|
||||||
Write-Host "===========================================" -ForegroundColor Green
|
Write-Host "===========================================" -ForegroundColor Green
|
||||||
Write-Host "--- Winget is installed ---" -ForegroundColor Green
|
Write-Host "--- Winget is installed ---" -ForegroundColor Green
|
||||||
Write-Host "===========================================" -ForegroundColor Green
|
Write-Host "===========================================" -ForegroundColor Green
|
||||||
Write-Host "Version: $wingetVersionFull" -ForegroundColor White
|
|
||||||
|
|
||||||
if (!$wingetPreview) {
|
if (!$wingetPreview) {
|
||||||
Write-Host " - Winget is a release version." -ForegroundColor Green
|
Write-Host " - Winget is a release version." -ForegroundColor Green
|
||||||
|
@ -54,21 +54,27 @@ if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:
|
|||||||
$PSBoundParameters.GetEnumerator() | ForEach-Object {
|
$PSBoundParameters.GetEnumerator() | ForEach-Object {
|
||||||
$argList += if ($_.Value -is [switch] -and $_.Value) {
|
$argList += if ($_.Value -is [switch] -and $_.Value) {
|
||||||
"-$($_.Key)"
|
"-$($_.Key)"
|
||||||
|
} elseif ($_.Value -is [array]) {
|
||||||
|
"-$($_.Key) $($_.Value -join ',')"
|
||||||
} elseif ($_.Value) {
|
} elseif ($_.Value) {
|
||||||
"-$($_.Key) `"$($_.Value)`""
|
"-$($_.Key) '$($_.Value)'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$script = if ($MyInvocation.MyCommand.Path) {
|
$script = if ($PSCommandPath) {
|
||||||
"& { & '$($MyInvocation.MyCommand.Path)' $argList }"
|
"& { & `'$($PSCommandPath)`' $($argList -join ' ') }"
|
||||||
} else {
|
} else {
|
||||||
"iex '& { $(irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1) } $argList'"
|
"&([ScriptBlock]::Create((irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1))) $($argList -join ' ')"
|
||||||
}
|
}
|
||||||
|
|
||||||
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
|
$powershellCmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
|
||||||
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd }
|
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { "$powershellCmd" }
|
||||||
|
|
||||||
Start-Process $processCmd -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -Command $script" -Verb RunAs
|
if ($processCmd -eq "wt.exe") {
|
||||||
|
Start-Process $processCmd -ArgumentList "$powershellCmd -ExecutionPolicy Bypass -NoProfile -Command `"$script`"" -Verb RunAs
|
||||||
|
} else {
|
||||||
|
Start-Process $processCmd -ArgumentList "-ExecutionPolicy Bypass -NoProfile -Command `"$script`"" -Verb RunAs
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user