mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-29 01:11:30 -06:00
Compare commits
19 Commits
df4b047ce2
...
af905488b0
Author | SHA1 | Date | |
---|---|---|---|
|
af905488b0 | ||
|
952c6b704a | ||
|
afe9635b19 | ||
|
84ffe1636f | ||
|
dd50b70bf9 | ||
|
dec704305f | ||
|
308360d3f5 | ||
|
14d6d07dc7 | ||
|
1337ac4359 | ||
|
07cac2a880 | ||
|
2ec750447c | ||
|
f03a43e8e9 | ||
|
3233841945 | ||
|
0ba0654a2e | ||
|
d64a3f7070 | ||
|
821cd10fa8 | ||
|
b8397ff49f | ||
|
23af79852a | ||
|
7bfcd7cb25 |
22
Compile.ps1
22
Compile.ps1
@ -24,15 +24,14 @@ Get-ChildItem .\functions -Recurse -File | ForEach-Object {
|
|||||||
Get-Content $psitem.FullName | Out-File ./$scriptname -Append -Encoding ascii
|
Get-Content $psitem.FullName | Out-File ./$scriptname -Append -Encoding ascii
|
||||||
}
|
}
|
||||||
|
|
||||||
$xaml = (Get-Content .\xaml\inputXML.xaml).replace("'","''")
|
|
||||||
Write-output "`$inputXML = '$xaml'" | Out-File ./$scriptname -Append -Encoding ascii
|
|
||||||
|
|
||||||
Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object {
|
Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object {
|
||||||
$json = (Get-Content $psitem.FullName).replace("'","''")
|
$json = (Get-Content $psitem.FullName).replace("'","''")
|
||||||
$sync.configs.$($psitem.BaseName) = $json | convertfrom-json
|
$sync.configs.$($psitem.BaseName) = $json | convertfrom-json
|
||||||
Write-output "`$sync.configs.$($psitem.BaseName) = '$json' `| convertfrom-json" | Out-File ./$scriptname -Append -Encoding ascii
|
Write-output "`$sync.configs.$($psitem.BaseName) = '$json' `| convertfrom-json" | Out-File ./$scriptname -Append -Encoding ascii
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$xaml = (Get-Content .\xaml\inputXML.xaml).replace("'","''")
|
||||||
|
|
||||||
# Dot-source the Get-TabXaml function
|
# Dot-source the Get-TabXaml function
|
||||||
. .\functions\private\Get-TabXaml.ps1
|
. .\functions\private\Get-TabXaml.ps1
|
||||||
|
|
||||||
@ -44,4 +43,21 @@ $tabColumns | Out-File -FilePath ".\xaml\inputTweaks.xaml" -Encoding ascii
|
|||||||
$tabColumns = Get-TabXaml "feature"
|
$tabColumns = Get-TabXaml "feature"
|
||||||
$tabColumns | Out-File -FilePath ".\xaml\inputFeatures.xaml" -Encoding ascii
|
$tabColumns | Out-File -FilePath ".\xaml\inputFeatures.xaml" -Encoding ascii
|
||||||
|
|
||||||
|
# Assuming inputApp.xaml is in the same directory as main.ps1
|
||||||
|
$appXamlPath = Join-Path -Path $PSScriptRoot -ChildPath "xaml/inputApp.xaml"
|
||||||
|
$tweaksXamlPath = Join-Path -Path $PSScriptRoot -ChildPath "xaml/inputTweaks.xaml"
|
||||||
|
$featuresXamlPath = Join-Path -Path $PSScriptRoot -ChildPath "xaml/inputFeatures.xaml"
|
||||||
|
|
||||||
|
# Load the XAML content from inputApp.xaml
|
||||||
|
$appXamlContent = Get-Content -Path $appXamlPath -Raw
|
||||||
|
$tweaksXamlContent = Get-Content -Path $tweaksXamlPath -Raw
|
||||||
|
$featuresXamlContent = Get-Content -Path $featuresXamlPath -Raw
|
||||||
|
|
||||||
|
# Replace the placeholder in $inputXML with the content of inputApp.xaml
|
||||||
|
$xaml = $xaml -replace "{{InstallPanel_applications}}", $appXamlContent
|
||||||
|
$xaml = $xaml -replace "{{InstallPanel_tweaks}}", $tweaksXamlContent
|
||||||
|
$xaml = $xaml -replace "{{InstallPanel_features}}", $featuresXamlContent
|
||||||
|
|
||||||
|
Write-output "`$inputXML = '$xaml'" | Out-File ./$scriptname -Append -Encoding ascii
|
||||||
|
|
||||||
Get-Content .\scripts\main.ps1 | Out-File ./$scriptname -Append -Encoding ascii
|
Get-Content .\scripts\main.ps1 | Out-File ./$scriptname -Append -Encoding ascii
|
@ -387,7 +387,7 @@
|
|||||||
"category": "Microsoft Tools",
|
"category": "Microsoft Tools",
|
||||||
"choco": "dotnet-8.0-runtime",
|
"choco": "dotnet-8.0-runtime",
|
||||||
"content": ".NET Desktop Runtime 8",
|
"content": ".NET Desktop Runtime 8",
|
||||||
"description": ".NET Desktop Runtime 8 is a runtime environment required for running applications developed with .NET 7.",
|
"description": ".NET Desktop Runtime 8 is a runtime environment required for running applications developed with .NET 8.",
|
||||||
"link": "https://dotnet.microsoft.com/download/dotnet/8.0",
|
"link": "https://dotnet.microsoft.com/download/dotnet/8.0",
|
||||||
"winget": "Microsoft.DotNet.DesktopRuntime.8"
|
"winget": "Microsoft.DotNet.DesktopRuntime.8"
|
||||||
},
|
},
|
||||||
|
@ -60,5 +60,35 @@
|
|||||||
"BorderColor": "#FFAC1C",
|
"BorderColor": "#FFAC1C",
|
||||||
"BorderOpacity": "0.8",
|
"BorderOpacity": "0.8",
|
||||||
"ShadowPulse": "0:0:3"
|
"ShadowPulse": "0:0:3"
|
||||||
|
},
|
||||||
|
"Dark": {
|
||||||
|
"ComboBoxBackgroundColor": "#000000",
|
||||||
|
"LabelboxForegroundColor": "#FFEE58",
|
||||||
|
"MainForegroundColor": "#9CCC65",
|
||||||
|
"MainBackgroundColor": "#000000",
|
||||||
|
"LabelBackgroundColor": "#000000",
|
||||||
|
"LinkForegroundColor": "#add8e6",
|
||||||
|
"LinkHoverForegroundColor": "#FFFFFF",
|
||||||
|
"ComboBoxForegroundColor": "#FFEE58",
|
||||||
|
"ButtonInstallBackgroundColor": "#222222",
|
||||||
|
"ButtonTweaksBackgroundColor": "#333333",
|
||||||
|
"ButtonConfigBackgroundColor": "#444444",
|
||||||
|
"ButtonUpdatesBackgroundColor": "#555555",
|
||||||
|
"ButtonInstallForegroundColor": "#FFFFFF",
|
||||||
|
"ButtonTweaksForegroundColor": "#FFFFFF",
|
||||||
|
"ButtonConfigForegroundColor": "#FFFFFF",
|
||||||
|
"ButtonUpdatesForegroundColor": "#FFFFFF",
|
||||||
|
"ButtonBackgroundColor": "#000019",
|
||||||
|
"ButtonBackgroundPressedColor": "#9CCC65",
|
||||||
|
"ButtonBackgroundMouseoverColor": "#FF5733",
|
||||||
|
"ButtonBackgroundSelectedColor": "#FF5733",
|
||||||
|
"ButtonForegroundColor": "#9CCC65",
|
||||||
|
"ButtonBorderThickness": "1",
|
||||||
|
"ButtonMargin": "1",
|
||||||
|
"ButtonCornerRadius": "2",
|
||||||
|
"ToggleButtonHeight": "25",
|
||||||
|
"BorderColor": "#FFAC1C",
|
||||||
|
"BorderOpacity": "0.2",
|
||||||
|
"ShadowPulse": "Forever"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2306,6 +2306,7 @@
|
|||||||
|
|
||||||
Write-Host \"Removing OneDrive leftovers\"
|
Write-Host \"Removing OneDrive leftovers\"
|
||||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\Microsoft\\OneDrive\"
|
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\Microsoft\\OneDrive\"
|
||||||
|
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\OneDrive\"
|
||||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:programdata\\Microsoft OneDrive\"
|
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:programdata\\Microsoft OneDrive\"
|
||||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:systemdrive\\OneDriveTemp\"
|
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:systemdrive\\OneDriveTemp\"
|
||||||
# check if directory is empty before removing:
|
# check if directory is empty before removing:
|
||||||
|
@ -33,7 +33,7 @@ Function Install-WinUtilProgramWinget {
|
|||||||
Start-Process -FilePath winget -ArgumentList "install -e --accept-source-agreements --accept-package-agreements --scope=machine --silent $Program" -NoNewWindow -Wait
|
Start-Process -FilePath winget -ArgumentList "install -e --accept-source-agreements --accept-package-agreements --scope=machine --silent $Program" -NoNewWindow -Wait
|
||||||
}
|
}
|
||||||
if($manage -eq "Uninstalling"){
|
if($manage -eq "Uninstalling"){
|
||||||
Start-Process -FilePath winget -ArgumentList "uninstall -e --purge --force --silent $Program" -NoNewWindow -Wait
|
Start-Process -FilePath winget -ArgumentList "uninstall -e --accept-source-agreements --purge --force --silent $Program" -NoNewWindow -Wait
|
||||||
}
|
}
|
||||||
|
|
||||||
$X++
|
$X++
|
||||||
|
@ -18,28 +18,23 @@ function Test-CompatibleImage() {
|
|||||||
<#
|
<#
|
||||||
|
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Checks the version of a Windows image and determines whether or not it is compatible depending on the Major property
|
Checks the version of a Windows image and determines whether or not it is compatible with a specific feature depending on a desired version
|
||||||
|
|
||||||
.PARAMETER imgVersion
|
.PARAMETER Name
|
||||||
The version of the Windows image
|
imgVersion - The version of the Windows image
|
||||||
|
desiredVersion - The version to compare the image version with
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param
|
param
|
||||||
(
|
(
|
||||||
[Parameter(Mandatory = $true)] [string] $imgVersion
|
[Parameter(Mandatory = $true, Position=0)] [string] $imgVersion,
|
||||||
|
[Parameter(Mandatory = $true, Position=1)] [Version] $desiredVersion
|
||||||
)
|
)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$version = [Version]$imgVersion
|
$version = [Version]$imgVersion
|
||||||
if ($version.Major -ge 10)
|
return $version -ge $desiredVersion
|
||||||
{
|
|
||||||
return $True
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return $False
|
|
||||||
}
|
|
||||||
} catch {
|
} catch {
|
||||||
return $False
|
return $False
|
||||||
}
|
}
|
||||||
@ -247,7 +242,7 @@ function Remove-FileOrDirectory([string] $pathToDelete, [string] $mask = "", [sw
|
|||||||
|
|
||||||
foreach($itemToDelete in $itemsToDelete)
|
foreach($itemToDelete in $itemsToDelete)
|
||||||
{
|
{
|
||||||
$status = "Deleteing $($itemToDelete)"
|
$status = "Deleting $($itemToDelete)"
|
||||||
Write-Progress -Activity "Removing Items" -Status $status -PercentComplete ($counter++/$itemsToDelete.Count*100)
|
Write-Progress -Activity "Removing Items" -Status $status -PercentComplete ($counter++/$itemsToDelete.Count*100)
|
||||||
|
|
||||||
if (Test-Path -Path "$($itemToDelete)" -PathType Container)
|
if (Test-Path -Path "$($itemToDelete)" -PathType Container)
|
||||||
@ -321,7 +316,7 @@ function New-Unattend {
|
|||||||
<unattend xmlns="urn:schemas-microsoft-com:unattend"
|
<unattend xmlns="urn:schemas-microsoft-com:unattend"
|
||||||
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
|
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<#REPLACEME#>
|
||||||
<settings pass="auditUser">
|
<settings pass="auditUser">
|
||||||
<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
<RunSynchronous>
|
<RunSynchronous>
|
||||||
@ -362,6 +357,26 @@ function New-Unattend {
|
|||||||
</settings>
|
</settings>
|
||||||
</unattend>
|
</unattend>
|
||||||
'@
|
'@
|
||||||
|
$specPass = @'
|
||||||
|
<settings pass="specialize">
|
||||||
|
<component name="Microsoft-Windows-SQMApi" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<CEIPEnabled>0</CEIPEnabled>
|
||||||
|
</component>
|
||||||
|
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<ConfigureChatAutoInstall>false</ConfigureChatAutoInstall>
|
||||||
|
</component>
|
||||||
|
</settings>
|
||||||
|
'@
|
||||||
|
if ((Test-CompatibleImage $imgVersion $([System.Version]::new(10,0,22000,1))) -eq $false)
|
||||||
|
{
|
||||||
|
# Replace the placeholder text with an empty string to make it valid for Windows 10 Setup
|
||||||
|
$unattend = $unattend.Replace("<#REPLACEME#>", "").Trim()
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Replace the placeholder text with the Specialize pass
|
||||||
|
$unattend = $unattend.Replace("<#REPLACEME#>", $specPass).Trim()
|
||||||
|
}
|
||||||
$unattend | Out-File -FilePath "$env:temp\unattend.xml" -Force
|
$unattend | Out-File -FilePath "$env:temp\unattend.xml" -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,6 +637,13 @@ function New-FirstRun {
|
|||||||
$shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`""
|
$shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`""
|
||||||
# Save the shortcut
|
# Save the shortcut
|
||||||
$shortcut.Save()
|
$shortcut.Save()
|
||||||
|
|
||||||
|
# Make the shortcut have 'Run as administrator' property on
|
||||||
|
$bytes = [System.IO.File]::ReadAllBytes($shortcutPath)
|
||||||
|
# Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex
|
||||||
|
$bytes[0x15] = $bytes[0x15] -bor 0x20
|
||||||
|
[System.IO.File]::WriteAllBytes($shortcutPath, $bytes)
|
||||||
|
|
||||||
Write-Host "Shortcut created at: $shortcutPath"
|
Write-Host "Shortcut created at: $shortcutPath"
|
||||||
#
|
#
|
||||||
# Done create WinUtil shortcut on the desktop
|
# Done create WinUtil shortcut on the desktop
|
||||||
|
29
functions/private/Invoke-WinUtilGPU.ps1
Normal file
29
functions/private/Invoke-WinUtilGPU.ps1
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
function Invoke-GPUCheck {
|
||||||
|
$gpuInfo = Get-WmiObject Win32_VideoController
|
||||||
|
|
||||||
|
foreach ($gpu in $gpuInfo) {
|
||||||
|
$gpuName = $gpu.Name
|
||||||
|
if ($gpuName -like "*NVIDIA*") {
|
||||||
|
return $true # NVIDIA GPU found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($gpu in $gpuInfo) {
|
||||||
|
$gpuName = $gpu.Name
|
||||||
|
if ($gpuName -like "*AMD Radeon RX*") {
|
||||||
|
return $true # AMD GPU Found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($gpu in $gpuInfo) {
|
||||||
|
$gpuName = $gpu.Name
|
||||||
|
if ($gpuName -like "*UHD*") {
|
||||||
|
return $false # Intel Intergrated GPU Found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($gpu in $gpuInfo) {
|
||||||
|
$gpuName = $gpu.Name
|
||||||
|
if ($gpuName -like "*AMD Radeon(TM)*") {
|
||||||
|
return $false # AMD Intergrated GPU Found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -20,11 +20,17 @@ function Test-WinUtilPackageManager {
|
|||||||
# Install Winget if not detected
|
# Install Winget if not detected
|
||||||
$wingetExists = Get-Command -Name winget -ErrorAction SilentlyContinue
|
$wingetExists = Get-Command -Name winget -ErrorAction SilentlyContinue
|
||||||
if ($wingetExists) {
|
if ($wingetExists) {
|
||||||
$wingetVersion = [System.Version]::Parse((winget --version).Trim('v'))
|
$wingetversionfull = (winget --version)
|
||||||
|
$wingetversiontrim = $wingetversionfull.Trim('v')
|
||||||
|
if ($wingetversiontrim.EndsWith("-preview")) {
|
||||||
|
$wingetversiontrim = $wingetversiontrim.Trim('-preview')
|
||||||
|
$wingetpreview = $true
|
||||||
|
}
|
||||||
|
$wingetVersion = [System.Version]::Parse($wingetversiontrim)
|
||||||
$minimumWingetVersion = [System.Version]::new(1,2,10691) # Win 11 23H2 comes with bad winget v1.2.10691
|
$minimumWingetVersion = [System.Version]::new(1,2,10691) # Win 11 23H2 comes with bad winget v1.2.10691
|
||||||
$wingetOutdated = $wingetVersion -le $minimumWingetVersion
|
$wingetOutdated = $wingetVersion -le $minimumWingetVersion
|
||||||
|
|
||||||
Write-Host "Winget v$wingetVersion"
|
Write-Host "Winget $wingetVersionfull"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$wingetExists -or $wingetOutdated) {
|
if (!$wingetExists -or $wingetOutdated) {
|
||||||
@ -37,7 +43,11 @@ function Test-WinUtilPackageManager {
|
|||||||
|
|
||||||
if ($winget) {
|
if ($winget) {
|
||||||
if ($wingetExists -and !$wingetOutdated) {
|
if ($wingetExists -and !$wingetOutdated) {
|
||||||
|
if (!$wingetpreview) {
|
||||||
Write-Host "- Winget up-to-date"
|
Write-Host "- Winget up-to-date"
|
||||||
|
} else {
|
||||||
|
Write-Host "- Winget preview version detected. Unexptected problems may occur" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,13 +160,18 @@ function Invoke-WPFGetIso {
|
|||||||
$wimFile = "$mountDir\sources\install.wim"
|
$wimFile = "$mountDir\sources\install.wim"
|
||||||
Write-Host "Getting image information $wimFile"
|
Write-Host "Getting image information $wimFile"
|
||||||
|
|
||||||
if (-not (Test-Path -Path $wimFile -PathType Leaf))
|
if ((-not (Test-Path -Path $wimFile -PathType Leaf)) -and (-not (Test-Path -Path $wimFile.Replace(".wim", ".esd").Trim() -PathType Leaf)))
|
||||||
{
|
{
|
||||||
$msg = "Install.wim file doesn't exist in the image, this could happen if you use unofficial Windows images, or a Media creation tool, which creates a final image that can not be modified. Please don't use shady images from the internet, use only official images. Here are instructions how to download ISO images if the Microsoft website is not showing the link to download and ISO. https://www.techrepublic.com/article/how-to-download-a-windows-10-iso-file-without-using-the-media-creation-tool/"
|
$msg = "Neither install.wim nor install.esd exist in the image, this could happen if you use unofficial Windows images. Please don't use shady images from the internet, use only official images. Here are instructions how to download ISO images if the Microsoft website is not showing the link to download and ISO. https://www.techrepublic.com/article/how-to-download-a-windows-10-iso-file-without-using-the-media-creation-tool/"
|
||||||
Write-Host $msg
|
Write-Host $msg
|
||||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
||||||
throw
|
throw
|
||||||
}
|
}
|
||||||
|
elseif ((-not (Test-Path -Path $wimFile -PathType Leaf)) -and (Test-Path -Path $wimFile.Replace(".wim", ".esd").Trim() -PathType Leaf))
|
||||||
|
{
|
||||||
|
Write-Host "Install.esd found on the image. It needs to be converted to a WIM file in order to begin processing"
|
||||||
|
$wimFile = $wimFile.Replace(".wim", ".esd").Trim()
|
||||||
|
}
|
||||||
$sync.MicrowinWindowsFlavors.Items.Clear()
|
$sync.MicrowinWindowsFlavors.Items.Clear()
|
||||||
Get-WindowsImage -ImagePath $wimFile | ForEach-Object {
|
Get-WindowsImage -ImagePath $wimFile | ForEach-Object {
|
||||||
$imageIdx = $_.ImageIndex
|
$imageIdx = $_.ImageIndex
|
||||||
|
@ -2,12 +2,12 @@ function Invoke-WPFInstall {
|
|||||||
<#
|
<#
|
||||||
|
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Installs the selected programs using winget
|
Installs the selected programs using winget, if one or more of the selected programs are already installed on the system, winget will try and perform an upgrade if there's a newer version to install.
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
if($sync.ProcessRunning){
|
if($sync.ProcessRunning){
|
||||||
$msg = "[Invoke-WPFInstall] Install process is currently running."
|
$msg = "[Invoke-WPFInstall] An Install process is currently running."
|
||||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -15,7 +15,7 @@ function Invoke-WPFInstall {
|
|||||||
$WingetInstall = (Get-WinUtilCheckBoxes)["Install"]
|
$WingetInstall = (Get-WinUtilCheckBoxes)["Install"]
|
||||||
|
|
||||||
if ($wingetinstall.Count -eq 0) {
|
if ($wingetinstall.Count -eq 0) {
|
||||||
$WarningMsg = "Please select the program(s) to install"
|
$WarningMsg = "Please select the program(s) to install or upgrade"
|
||||||
[System.Windows.MessageBox]::Show($WarningMsg, $AppTitle, [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
[System.Windows.MessageBox]::Show($WarningMsg, $AppTitle, [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,30 @@ public class PowerManagement {
|
|||||||
$mountDir = $sync.MicrowinMountDir.Text
|
$mountDir = $sync.MicrowinMountDir.Text
|
||||||
$scratchDir = $sync.MicrowinScratchDir.Text
|
$scratchDir = $sync.MicrowinScratchDir.Text
|
||||||
|
|
||||||
|
# Detect if the Windows image is an ESD file and convert it to WIM
|
||||||
|
if (-not (Test-Path -Path $mountDir\sources\install.wim -PathType Leaf) -and (Test-Path -Path $mountDir\sources\install.esd -PathType Leaf))
|
||||||
|
{
|
||||||
|
Write-Host "Exporting Windows image to a WIM file, keeping the index we want to work on. This can take several minutes, depending on the performance of your computer..."
|
||||||
|
Export-WindowsImage -SourceImagePath $mountDir\sources\install.esd -SourceIndex $index -DestinationImagePath $mountDir\sources\install.wim -CompressionType "Max"
|
||||||
|
if ($?)
|
||||||
|
{
|
||||||
|
Remove-Item -Path $mountDir\sources\install.esd -Force
|
||||||
|
# Since we've already exported the image index we wanted, switch to the first one
|
||||||
|
$index = 1
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$msg = "The export process has failed and MicroWin processing cannot continue"
|
||||||
|
Write-Host "Failed to export the image"
|
||||||
|
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$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 ((Test-CompatibleImage $imgVersion) -eq $false)
|
if ((Test-CompatibleImage $imgVersion $([System.Version]::new(10,0,10240,0))) -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."
|
||||||
|
@ -52,25 +52,14 @@ $sync.runspace.Open()
|
|||||||
|
|
||||||
$inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window'
|
$inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window'
|
||||||
|
|
||||||
# Assuming inputApp.xaml is in the same directory as main.ps1
|
|
||||||
$appXamlPath = Join-Path -Path $PSScriptRoot -ChildPath "xaml/inputApp.xaml"
|
|
||||||
$tweaksXamlPath = Join-Path -Path $PSScriptRoot -ChildPath "xaml/inputTweaks.xaml"
|
|
||||||
$featuresXamlPath = Join-Path -Path $PSScriptRoot -ChildPath "xaml/inputFeatures.xaml"
|
|
||||||
|
|
||||||
# Load the XAML content from inputApp.xaml
|
|
||||||
$appXamlContent = Get-Content -Path $appXamlPath -Raw
|
|
||||||
$tweaksXamlContent = Get-Content -Path $tweaksXamlPath -Raw
|
|
||||||
$featuresXamlContent = Get-Content -Path $featuresXamlPath -Raw
|
|
||||||
|
|
||||||
# Replace the placeholder in $inputXML with the content of inputApp.xaml
|
|
||||||
$inputXML = $inputXML -replace "{{InstallPanel_applications}}", $appXamlContent
|
|
||||||
$inputXML = $inputXML -replace "{{InstallPanel_tweaks}}", $tweaksXamlContent
|
|
||||||
$inputXML = $inputXML -replace "{{InstallPanel_features}}", $featuresXamlContent
|
|
||||||
|
|
||||||
|
|
||||||
if ((Get-WinUtilToggleStatus WPFToggleDarkMode) -eq $True) {
|
if ((Get-WinUtilToggleStatus WPFToggleDarkMode) -eq $True) {
|
||||||
|
if (Invoke-GPUCheck -eq $True) {
|
||||||
$ctttheme = 'Matrix'
|
$ctttheme = 'Matrix'
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$ctttheme = 'Dark'
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$ctttheme = 'Classic'
|
$ctttheme = 'Classic'
|
||||||
}
|
}
|
||||||
|
3115
winutil.ps1
3115
winutil.ps1
File diff suppressed because it is too large
Load Diff
@ -399,7 +399,7 @@
|
|||||||
<CheckBox Name="WPFInstalldotnet7" Content=".NET Desktop Runtime 7" ToolTip=".NET Desktop Runtime 7 is a runtime environment required for running applications developed with .NET 7." Margin="0,0,2,0"/><TextBlock Name="WPFInstalldotnet7Link" Style="{StaticResource HoverTextBlockStyle}" Text="(?)" ToolTip="https://dotnet.microsoft.com/download/dotnet/7.0" />
|
<CheckBox Name="WPFInstalldotnet7" Content=".NET Desktop Runtime 7" ToolTip=".NET Desktop Runtime 7 is a runtime environment required for running applications developed with .NET 7." Margin="0,0,2,0"/><TextBlock Name="WPFInstalldotnet7Link" Style="{StaticResource HoverTextBlockStyle}" Text="(?)" ToolTip="https://dotnet.microsoft.com/download/dotnet/7.0" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<CheckBox Name="WPFInstalldotnet8" Content=".NET Desktop Runtime 8" ToolTip=".NET Desktop Runtime 8 is a runtime environment required for running applications developed with .NET 7." Margin="0,0,2,0"/><TextBlock Name="WPFInstalldotnet8Link" Style="{StaticResource HoverTextBlockStyle}" Text="(?)" ToolTip="https://dotnet.microsoft.com/download/dotnet/8.0" />
|
<CheckBox Name="WPFInstalldotnet8" Content=".NET Desktop Runtime 8" ToolTip=".NET Desktop Runtime 8 is a runtime environment required for running applications developed with .NET 8." Margin="0,0,2,0"/><TextBlock Name="WPFInstalldotnet8Link" Style="{StaticResource HoverTextBlockStyle}" Text="(?)" ToolTip="https://dotnet.microsoft.com/download/dotnet/8.0" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<CheckBox Name="WPFInstallnuget" Content="NuGet" ToolTip="NuGet is a package manager for the .NET framework, enabling developers to manage and share libraries in their .NET applications." Margin="0,0,2,0"/><TextBlock Name="WPFInstallnugetLink" Style="{StaticResource HoverTextBlockStyle}" Text="(?)" ToolTip="https://www.nuget.org/" />
|
<CheckBox Name="WPFInstallnuget" Content="NuGet" ToolTip="NuGet is a package manager for the .NET framework, enabling developers to manage and share libraries in their .NET applications." Margin="0,0,2,0"/><TextBlock Name="WPFInstallnugetLink" Style="{StaticResource HoverTextBlockStyle}" Text="(?)" ToolTip="https://www.nuget.org/" />
|
||||||
|
@ -690,7 +690,7 @@
|
|||||||
<RowDefinition Height="0.95*"/>
|
<RowDefinition Height="0.95*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel Background="{MainBackgroundColor}" Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="0" Grid.ColumnSpan="3" Margin="5">
|
<StackPanel Background="{MainBackgroundColor}" Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="0" Grid.ColumnSpan="3" Margin="5">
|
||||||
<Button Name="WPFinstall" Content=" Install Selected" Margin="2" />
|
<Button Name="WPFinstall" Content=" Install/Upgrade Selected" Margin="2" />
|
||||||
<Button Name="WPFInstallUpgrade" Content=" Upgrade All" Margin="2"/>
|
<Button Name="WPFInstallUpgrade" Content=" Upgrade All" Margin="2"/>
|
||||||
<Button Name="WPFuninstall" Content=" Uninstall Selection" Margin="2"/>
|
<Button Name="WPFuninstall" Content=" Uninstall Selection" Margin="2"/>
|
||||||
<Button Name="WPFGetInstalled" Content=" Get Installed" Margin="2"/>
|
<Button Name="WPFGetInstalled" Content=" Get Installed" Margin="2"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user