mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-22 05:51:30 -06:00
bug fixes
This commit is contained in:
parent
d0aa396c2a
commit
f39deab555
@ -8,9 +8,9 @@ function Get-Oscdimg {
|
|||||||
Get-Oscdimg
|
Get-Oscdimg
|
||||||
#>
|
#>
|
||||||
param( [Parameter(Mandatory=$true)]
|
param( [Parameter(Mandatory=$true)]
|
||||||
$oscdimgPath = "$env:TEMP\oscdimg.exe"
|
[string]$oscdimgPath
|
||||||
)
|
)
|
||||||
|
$oscdimgPath = "$env:TEMP\oscdimg.exe"
|
||||||
$downloadUrl = "https://github.com/ChrisTitusTech/winutil/raw/main/releases/oscdimg.exe"
|
$downloadUrl = "https://github.com/ChrisTitusTech/winutil/raw/main/releases/oscdimg.exe"
|
||||||
Invoke-RestMethod -Uri $downloadUrl -OutFile $oscdimgPath
|
Invoke-RestMethod -Uri $downloadUrl -OutFile $oscdimgPath
|
||||||
$hashResult = Get-FileHash -Path $oscdimgPath -Algorithm SHA256
|
$hashResult = Get-FileHash -Path $oscdimgPath -Algorithm SHA256
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
function Get-WinUtilRegistry {
|
|
||||||
<#
|
|
||||||
|
|
||||||
.SYNOPSIS
|
|
||||||
Gets the value of a registry key
|
|
||||||
|
|
||||||
.EXAMPLE
|
|
||||||
Get-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
|
|
||||||
|
|
||||||
#>
|
|
||||||
param (
|
|
||||||
$Name,
|
|
||||||
$Path,
|
|
||||||
$Type,
|
|
||||||
$Value
|
|
||||||
)
|
|
||||||
|
|
||||||
Try{
|
|
||||||
$syscheckvalue = Get-ItemPropertyValue -Path $Path -Value $Value # Return Value
|
|
||||||
|
|
||||||
}
|
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
|
||||||
}
|
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
|
||||||
}
|
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
|
||||||
}
|
|
||||||
}
|
|
@ -41,37 +41,7 @@ function Install-WinUtilWinget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Running Alternative Installers and Direct Installing"
|
Write-Host "Running Alternative Installers and Direct Installing"
|
||||||
Write-Host "- Attempting first install method..."
|
# Checks if winget is installed via Chocolatey
|
||||||
|
|
||||||
$wingetURL = "https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
|
|
||||||
$wingetFileName = Split-Path $wingetURL -Leaf
|
|
||||||
$wingetInstallerPath = Join-Path $env:TEMP $wingetFileName
|
|
||||||
|
|
||||||
Invoke-WebRequest -Uri $wingetURL -OutFile $wingetInstallerPath
|
|
||||||
Add-AppxPackage -Path $wingetInstallerPath
|
|
||||||
if (Test-WinUtilPackageManager -winget) {
|
|
||||||
# Checks if winget executable exists and if the Windows Version is 1809 or higher
|
|
||||||
Write-Host "Winget Installed via GitHub"
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
Write-Host "- Failed to install Winget via GitHub"
|
|
||||||
}
|
|
||||||
# Second Method
|
|
||||||
Write-Host "- Attempting second install method..."
|
|
||||||
|
|
||||||
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
|
|
||||||
Install-Script -Name winget-install -Force
|
|
||||||
$wingetArgument = "-ExecutionPolicy Bypass winget-install.ps1"
|
|
||||||
Start-Process powershell -ArgumentList $wingetArgument -Wait
|
|
||||||
if (Test-WinUtilPackageManager -winget) {
|
|
||||||
# Checks if winget executable exists and if the Windows Version is 1809 or higher
|
|
||||||
Write-Host "Winget Installed via PowerShell Gallery Script"
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
Write-Host "- Failed to install Winget via PowerShell Gallery Script"
|
|
||||||
}
|
|
||||||
# Third Method
|
|
||||||
Write-Host "- Attempting third install method..."
|
|
||||||
|
|
||||||
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget --force" -Wait -NoNewWindow
|
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget --force" -Wait -NoNewWindow
|
||||||
if (Test-WinUtilPackageManager -winget) {
|
if (Test-WinUtilPackageManager -winget) {
|
||||||
|
@ -14,7 +14,7 @@ function Invoke-MicroWin-Helper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Is-CompatibleImage() {
|
function Test-CompatibleImage() {
|
||||||
<#
|
<#
|
||||||
|
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
@ -14,7 +14,6 @@ function Invoke-ScratchDialog {
|
|||||||
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
|
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
|
||||||
$Dialog = New-Object System.Windows.Forms.FolderBrowserDialog
|
$Dialog = New-Object System.Windows.Forms.FolderBrowserDialog
|
||||||
$Dialog.SelectedPath = $sync.MicrowinScratchDirBox.Text
|
$Dialog.SelectedPath = $sync.MicrowinScratchDirBox.Text
|
||||||
$DialogShowNewFolderButton = $true
|
|
||||||
$Dialog.ShowDialog()
|
$Dialog.ShowDialog()
|
||||||
$filePath = $Dialog.SelectedPath
|
$filePath = $Dialog.SelectedPath
|
||||||
Write-Host "No ISO is chosen+ $filePath"
|
Write-Host "No ISO is chosen+ $filePath"
|
||||||
|
@ -60,7 +60,7 @@ public class PowerManagement {
|
|||||||
$imgVersion = (Get-WindowsImage -ImagePath $mountDir\sources\install.wim -Index $index).Version
|
$imgVersion = (Get-WindowsImage -ImagePath $mountDir\sources\install.wim -Index $index).Version
|
||||||
|
|
||||||
# Detect image version to avoid performing MicroWin processing on Windows 8 and earlier
|
# Detect image version to avoid performing MicroWin processing on Windows 8 and earlier
|
||||||
if ((Is-CompatibleImage $imgVersion) -eq $false)
|
if ((Test-CompatibleImage $imgVersion) -eq $false)
|
||||||
{
|
{
|
||||||
$msg = "This image is not compatible with MicroWin processing. Make sure it isn't a Windows 8 or earlier image."
|
$msg = "This image is not compatible with MicroWin processing. Make sure it isn't a Windows 8 or earlier image."
|
||||||
$dlg_msg = $msg + "`n`nIf you want more information, the version of the image selected is $($imgVersion)`n`nIf an image has been incorrectly marked as incompatible, report an issue to the developers."
|
$dlg_msg = $msg + "`n`nIf you want more information, the version of the image selected is $($imgVersion)`n`nIf an image has been incorrectly marked as incompatible, report an issue to the developers."
|
||||||
|
@ -37,7 +37,7 @@ function Invoke-WPFShortcut {
|
|||||||
$Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName)
|
$Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName)
|
||||||
$Shortcut.TargetPath = $SourceExe
|
$Shortcut.TargetPath = $SourceExe
|
||||||
$Shortcut.Arguments = $ArgumentsToSourceExe
|
$Shortcut.Arguments = $ArgumentsToSourceExe
|
||||||
if ($iconPath -ne $null) {
|
if ($null -ne $iconPath) {
|
||||||
$shortcut.IconLocation = $iconPath
|
$shortcut.IconLocation = $iconPath
|
||||||
}
|
}
|
||||||
$Shortcut.Save()
|
$Shortcut.Save()
|
||||||
|
81
winutil.ps1
81
winutil.ps1
@ -10,7 +10,7 @@
|
|||||||
Author : Chris Titus @christitustech
|
Author : Chris Titus @christitustech
|
||||||
Runspace Author: @DeveloperDurp
|
Runspace Author: @DeveloperDurp
|
||||||
GitHub : https://github.com/ChrisTitusTech
|
GitHub : https://github.com/ChrisTitusTech
|
||||||
Version : 24.02.06
|
Version : 24.02.07
|
||||||
#>
|
#>
|
||||||
param (
|
param (
|
||||||
[switch]$Debug,
|
[switch]$Debug,
|
||||||
@ -47,7 +47,7 @@ Add-Type -AssemblyName System.Windows.Forms
|
|||||||
# Variable to sync between runspaces
|
# Variable to sync between runspaces
|
||||||
$sync = [Hashtable]::Synchronized(@{})
|
$sync = [Hashtable]::Synchronized(@{})
|
||||||
$sync.PSScriptRoot = $PSScriptRoot
|
$sync.PSScriptRoot = $PSScriptRoot
|
||||||
$sync.version = "24.02.06"
|
$sync.version = "24.02.07"
|
||||||
$sync.configs = @{}
|
$sync.configs = @{}
|
||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
|
|
||||||
@ -241,9 +241,9 @@ function Get-Oscdimg {
|
|||||||
Get-Oscdimg
|
Get-Oscdimg
|
||||||
#>
|
#>
|
||||||
param( [Parameter(Mandatory=$true)]
|
param( [Parameter(Mandatory=$true)]
|
||||||
$oscdimgPath = "$env:TEMP\oscdimg.exe"
|
[string]$oscdimgPath
|
||||||
)
|
)
|
||||||
|
$oscdimgPath = "$env:TEMP\oscdimg.exe"
|
||||||
$downloadUrl = "https://github.com/ChrisTitusTech/winutil/raw/main/releases/oscdimg.exe"
|
$downloadUrl = "https://github.com/ChrisTitusTech/winutil/raw/main/releases/oscdimg.exe"
|
||||||
Invoke-RestMethod -Uri $downloadUrl -OutFile $oscdimgPath
|
Invoke-RestMethod -Uri $downloadUrl -OutFile $oscdimgPath
|
||||||
$hashResult = Get-FileHash -Path $oscdimgPath -Algorithm SHA256
|
$hashResult = Get-FileHash -Path $oscdimgPath -Algorithm SHA256
|
||||||
@ -359,38 +359,6 @@ function Get-WinUtilInstallerProcess {
|
|||||||
}
|
}
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
function Get-WinUtilRegistry {
|
|
||||||
<#
|
|
||||||
|
|
||||||
.SYNOPSIS
|
|
||||||
Gets the value of a registry key
|
|
||||||
|
|
||||||
.EXAMPLE
|
|
||||||
Get-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
|
|
||||||
|
|
||||||
#>
|
|
||||||
param (
|
|
||||||
$Name,
|
|
||||||
$Path,
|
|
||||||
$Type,
|
|
||||||
$Value
|
|
||||||
)
|
|
||||||
|
|
||||||
Try{
|
|
||||||
$syscheckvalue = Get-ItemPropertyValue -Path $Path -Value $Value # Return Value
|
|
||||||
|
|
||||||
}
|
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
|
||||||
}
|
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
|
||||||
}
|
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Function Get-WinUtilToggleStatus {
|
Function Get-WinUtilToggleStatus {
|
||||||
<#
|
<#
|
||||||
|
|
||||||
@ -631,37 +599,7 @@ function Install-WinUtilWinget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Running Alternative Installers and Direct Installing"
|
Write-Host "Running Alternative Installers and Direct Installing"
|
||||||
Write-Host "- Attempting first install method..."
|
# Checks if winget is installed via Chocolatey
|
||||||
|
|
||||||
$wingetURL = "https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
|
|
||||||
$wingetFileName = Split-Path $wingetURL -Leaf
|
|
||||||
$wingetInstallerPath = Join-Path $env:TEMP $wingetFileName
|
|
||||||
|
|
||||||
Invoke-WebRequest -Uri $wingetURL -OutFile $wingetInstallerPath
|
|
||||||
Add-AppxPackage -Path $wingetInstallerPath
|
|
||||||
if (Test-WinUtilPackageManager -winget) {
|
|
||||||
# Checks if winget executable exists and if the Windows Version is 1809 or higher
|
|
||||||
Write-Host "Winget Installed via GitHub"
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
Write-Host "- Failed to install Winget via GitHub"
|
|
||||||
}
|
|
||||||
# Second Method
|
|
||||||
Write-Host "- Attempting second install method..."
|
|
||||||
|
|
||||||
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
|
|
||||||
Install-Script -Name winget-install -Force
|
|
||||||
$wingetArgument = "-ExecutionPolicy Bypass winget-install.ps1"
|
|
||||||
Start-Process powershell -ArgumentList $wingetArgument -Wait
|
|
||||||
if (Test-WinUtilPackageManager -winget) {
|
|
||||||
# Checks if winget executable exists and if the Windows Version is 1809 or higher
|
|
||||||
Write-Host "Winget Installed via PowerShell Gallery Script"
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
Write-Host "- Failed to install Winget via PowerShell Gallery Script"
|
|
||||||
}
|
|
||||||
# Third Method
|
|
||||||
Write-Host "- Attempting third install method..."
|
|
||||||
|
|
||||||
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget --force" -Wait -NoNewWindow
|
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget --force" -Wait -NoNewWindow
|
||||||
if (Test-WinUtilPackageManager -winget) {
|
if (Test-WinUtilPackageManager -winget) {
|
||||||
@ -692,7 +630,7 @@ function Invoke-MicroWin-Helper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Is-CompatibleImage() {
|
function Test-CompatibleImage() {
|
||||||
<#
|
<#
|
||||||
|
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
@ -2422,7 +2360,6 @@ function Invoke-ScratchDialog {
|
|||||||
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
|
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
|
||||||
$Dialog = New-Object System.Windows.Forms.FolderBrowserDialog
|
$Dialog = New-Object System.Windows.Forms.FolderBrowserDialog
|
||||||
$Dialog.SelectedPath = $sync.MicrowinScratchDirBox.Text
|
$Dialog.SelectedPath = $sync.MicrowinScratchDirBox.Text
|
||||||
$DialogShowNewFolderButton = $true
|
|
||||||
$Dialog.ShowDialog()
|
$Dialog.ShowDialog()
|
||||||
$filePath = $Dialog.SelectedPath
|
$filePath = $Dialog.SelectedPath
|
||||||
Write-Host "No ISO is chosen+ $filePath"
|
Write-Host "No ISO is chosen+ $filePath"
|
||||||
@ -3376,7 +3313,7 @@ public class PowerManagement {
|
|||||||
$imgVersion = (Get-WindowsImage -ImagePath $mountDir\sources\install.wim -Index $index).Version
|
$imgVersion = (Get-WindowsImage -ImagePath $mountDir\sources\install.wim -Index $index).Version
|
||||||
|
|
||||||
# Detect image version to avoid performing MicroWin processing on Windows 8 and earlier
|
# Detect image version to avoid performing MicroWin processing on Windows 8 and earlier
|
||||||
if ((Is-CompatibleImage $imgVersion) -eq $false)
|
if ((Test-CompatibleImage $imgVersion) -eq $false)
|
||||||
{
|
{
|
||||||
$msg = "This image is not compatible with MicroWin processing. Make sure it isn't a Windows 8 or earlier image."
|
$msg = "This image is not compatible with MicroWin processing. Make sure it isn't a Windows 8 or earlier image."
|
||||||
$dlg_msg = $msg + "`n`nIf you want more information, the version of the image selected is $($imgVersion)`n`nIf an image has been incorrectly marked as incompatible, report an issue to the developers."
|
$dlg_msg = $msg + "`n`nIf you want more information, the version of the image selected is $($imgVersion)`n`nIf an image has been incorrectly marked as incompatible, report an issue to the developers."
|
||||||
@ -3939,7 +3876,7 @@ function Invoke-WPFShortcut {
|
|||||||
$Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName)
|
$Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName)
|
||||||
$Shortcut.TargetPath = $SourceExe
|
$Shortcut.TargetPath = $SourceExe
|
||||||
$Shortcut.Arguments = $ArgumentsToSourceExe
|
$Shortcut.Arguments = $ArgumentsToSourceExe
|
||||||
if ($iconPath -ne $null) {
|
if ($null -ne $iconPath) {
|
||||||
$shortcut.IconLocation = $iconPath
|
$shortcut.IconLocation = $iconPath
|
||||||
}
|
}
|
||||||
$Shortcut.Save()
|
$Shortcut.Save()
|
||||||
@ -7731,7 +7668,7 @@ $sync.configs.applications = '{
|
|||||||
"WPFInstallintelpresentmon": {
|
"WPFInstallintelpresentmon": {
|
||||||
"category": "Utilities",
|
"category": "Utilities",
|
||||||
"choco": "na",
|
"choco": "na",
|
||||||
"content": "Intel?? PresentMon",
|
"content": "Intel? PresentMon",
|
||||||
"description": "A new gaming performance overlay and telemetry application to monitor and measure your gaming experience.",
|
"description": "A new gaming performance overlay and telemetry application to monitor and measure your gaming experience.",
|
||||||
"link": "https://game.intel.com/us/stories/intel-presentmon/",
|
"link": "https://game.intel.com/us/stories/intel-presentmon/",
|
||||||
"winget": "Intel.PresentMon.Beta"
|
"winget": "Intel.PresentMon.Beta"
|
||||||
|
Loading…
Reference in New Issue
Block a user