mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 22:55:52 -06:00
code format using powershell VS code extension (#28)
This commit is contained in:
parent
b670968731
commit
4d2364072e
28
winutil.ps1
28
winutil.ps1
@ -22,7 +22,8 @@ catch [System.Management.Automation.MethodInvocationException] {
|
|||||||
write-warning "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n"
|
write-warning "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch{# If it broke some other way <img draggable="false" role="img" class="emoji" alt="😀" src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/svg/1f600.svg">
|
catch {
|
||||||
|
# If it broke some other way <img draggable="false" role="img" class="emoji" alt="😀" src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/svg/1f600.svg">
|
||||||
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."
|
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,10 +381,13 @@ $WPFinstall.Add_Click({
|
|||||||
|
|
||||||
# Check if winget is installed
|
# Check if winget is installed
|
||||||
Write-Host "Checking if Winget is Installed..."
|
Write-Host "Checking if Winget is Installed..."
|
||||||
if (Test-Path ~\AppData\Local\Microsoft\WindowsApps\winget.exe){ #Checks if winget executable exists and if the Windows Version is 1809 or higher
|
if (Test-Path ~\AppData\Local\Microsoft\WindowsApps\winget.exe) {
|
||||||
|
#Checks if winget executable exists and if the Windows Version is 1809 or higher
|
||||||
Write-Host "Winget Already Installed"
|
Write-Host "Winget Already Installed"
|
||||||
}else{
|
}
|
||||||
if(((((Get-ComputerInfo).OSName.IndexOf("LTSC")) -ne -1) -or ((Get-ComputerInfo).OSName.IndexOf("Server") -ne -1)) -and (((Get-ComputerInfo).WindowsVersion) -ge "1809")){#Checks if Windows edition is LTSC/Server 2019+
|
else {
|
||||||
|
if (((((Get-ComputerInfo).OSName.IndexOf("LTSC")) -ne -1) -or ((Get-ComputerInfo).OSName.IndexOf("Server") -ne -1)) -and (((Get-ComputerInfo).WindowsVersion) -ge "1809")) {
|
||||||
|
#Checks if Windows edition is LTSC/Server 2019+
|
||||||
#Manually Installing Winget
|
#Manually Installing Winget
|
||||||
Write-Host "Running Alternative Installer for LTSC/Server Editions"
|
Write-Host "Running Alternative Installer for LTSC/Server Editions"
|
||||||
|
|
||||||
@ -409,9 +413,12 @@ $WPFinstall.Add_Click({
|
|||||||
Remove-Item -Path ".\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -Force
|
Remove-Item -Path ".\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -Force
|
||||||
Remove-Item -Path ".\b0a0692da1034339b76dce1c298a1e42_License1.xml" -Force
|
Remove-Item -Path ".\b0a0692da1034339b76dce1c298a1e42_License1.xml" -Force
|
||||||
Write-Host "Removed Files that are no longer needed"
|
Write-Host "Removed Files that are no longer needed"
|
||||||
}elseif(((Get-ComputerInfo).WindowsVersion) -lt "1809"){ #Checks if Windows Version is too old for winget
|
}
|
||||||
|
elseif (((Get-ComputerInfo).WindowsVersion) -lt "1809") {
|
||||||
|
#Checks if Windows Version is too old for winget
|
||||||
Write-Host "Winget is not supported on this version of Windows (Pre-1809)"
|
Write-Host "Winget is not supported on this version of Windows (Pre-1809)"
|
||||||
}else{
|
}
|
||||||
|
else {
|
||||||
#Installing Winget from the Microsoft Store
|
#Installing Winget from the Microsoft Store
|
||||||
Write-Host "Winget not found, installing it now."
|
Write-Host "Winget not found, installing it now."
|
||||||
Start-Process "ms-appinstaller:?source=https://aka.ms/getwinget"
|
Start-Process "ms-appinstaller:?source=https://aka.ms/getwinget"
|
||||||
@ -425,8 +432,7 @@ $WPFinstall.Add_Click({
|
|||||||
$wingetinstall.ToArray()
|
$wingetinstall.ToArray()
|
||||||
# Define Output variable
|
# Define Output variable
|
||||||
$wingetResult = New-Object System.Collections.Generic.List[System.Object]
|
$wingetResult = New-Object System.Collections.Generic.List[System.Object]
|
||||||
foreach ( $node in $wingetinstall )
|
foreach ( $node in $wingetinstall ) {
|
||||||
{
|
|
||||||
Start-Process powershell.exe -Verb RunAs -ArgumentList "-command winget install -e --accept-source-agreements --accept-package-agreements --silent $node | Out-Host" -Wait -WindowStyle Maximized
|
Start-Process powershell.exe -Verb RunAs -ArgumentList "-command winget install -e --accept-source-agreements --accept-package-agreements --silent $node | Out-Host" -Wait -WindowStyle Maximized
|
||||||
$wingetResult.Add("$node`n")
|
$wingetResult.Add("$node`n")
|
||||||
}
|
}
|
||||||
@ -757,7 +763,8 @@ $WPFtweaksbutton.Add_Click({
|
|||||||
Stop-Process $taskmgr
|
Stop-Process $taskmgr
|
||||||
$preferences.Preferences[28] = 0
|
$preferences.Preferences[28] = 0
|
||||||
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager" -Name "Preferences" -Type Binary -Value $preferences.Preferences
|
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager" -Name "Preferences" -Type Binary -Value $preferences.Preferences
|
||||||
} else {Write-Host "Task Manager patch not run in builds 22557+ due to bug"}
|
}
|
||||||
|
else { Write-Host "Task Manager patch not run in builds 22557+ due to bug" }
|
||||||
|
|
||||||
Write-Host "Showing file operations details..."
|
Write-Host "Showing file operations details..."
|
||||||
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager")) {
|
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager")) {
|
||||||
@ -1394,7 +1401,8 @@ $WPFFixesUpdate.Add_Click({
|
|||||||
Write-Host "10) Attempting to install the Windows Update Agent..."
|
Write-Host "10) Attempting to install the Windows Update Agent..."
|
||||||
If ($arch -eq 64) {
|
If ($arch -eq 64) {
|
||||||
wusa Windows8-RT-KB2937636-x64 /quiet
|
wusa Windows8-RT-KB2937636-x64 /quiet
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
wusa Windows8-RT-KB2937636-x86 /quiet
|
wusa Windows8-RT-KB2937636-x86 /quiet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user