mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 10:32:35 -05:00
Result of 'Invoke-Preprocessing' Script
This commit is contained in:
@ -2515,8 +2515,7 @@
|
|||||||
$OneDriveUninstallString = Get-ItemPropertyValue \"$regPath\" -Name \"UninstallString\"
|
$OneDriveUninstallString = Get-ItemPropertyValue \"$regPath\" -Name \"UninstallString\"
|
||||||
$OneDriveExe, $OneDriveArgs = $OneDriveUninstallString.Split(\" \")
|
$OneDriveExe, $OneDriveArgs = $OneDriveUninstallString.Split(\" \")
|
||||||
Start-Process -FilePath $OneDriveExe -ArgumentList \"$OneDriveArgs /silent\" -NoNewWindow -Wait
|
Start-Process -FilePath $OneDriveExe -ArgumentList \"$OneDriveArgs /silent\" -NoNewWindow -Wait
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
Write-Host \"Onedrive dosn't seem to be installed anymore\" -ForegroundColor Red
|
Write-Host \"Onedrive dosn't seem to be installed anymore\" -ForegroundColor Red
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2583,8 +2582,7 @@
|
|||||||
Write-Host \"Please Note - The OneDrive folder at $OneDrivePath may still have items in it. You must manually delete it, but all the files should already be copied to the base user folder.\"
|
Write-Host \"Please Note - The OneDrive folder at $OneDrivePath may still have items in it. You must manually delete it, but all the files should already be copied to the base user folder.\"
|
||||||
Write-Host \"If there are Files missing afterwards, please Login to Onedrive.com and Download them manually\" -ForegroundColor Yellow
|
Write-Host \"If there are Files missing afterwards, please Login to Onedrive.com and Download them manually\" -ForegroundColor Yellow
|
||||||
Start-Sleep 5
|
Start-Sleep 5
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
Write-Host \"Something went Wrong during the Unistallation of OneDrive\" -ForegroundColor Red
|
Write-Host \"Something went Wrong during the Unistallation of OneDrive\" -ForegroundColor Red
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@ -2784,8 +2782,7 @@
|
|||||||
try {
|
try {
|
||||||
Invoke-WebRequest -Uri $remoteHostsUrl -OutFile $tempHostsPath
|
Invoke-WebRequest -Uri $remoteHostsUrl -OutFile $tempHostsPath
|
||||||
Write-Output \"Downloaded the remote HOSTS file to a temporary location.\"
|
Write-Output \"Downloaded the remote HOSTS file to a temporary location.\"
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Error \"Failed to download the HOSTS file. Error: $_\"
|
Write-Error \"Failed to download the HOSTS file. Error: $_\"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2811,8 +2808,7 @@
|
|||||||
$combinedContent | Set-Content $localHostsPath -Encoding ASCII
|
$combinedContent | Set-Content $localHostsPath -Encoding ASCII
|
||||||
Write-Output \"Successfully added the AdobeNetBlock.\"
|
Write-Output \"Successfully added the AdobeNetBlock.\"
|
||||||
}
|
}
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Error \"Error during processing: $_\"
|
Write-Error \"Error during processing: $_\"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2823,8 +2819,7 @@
|
|||||||
try {
|
try {
|
||||||
Invoke-Expression \"ipconfig /flushdns\"
|
Invoke-Expression \"ipconfig /flushdns\"
|
||||||
Write-Output \"DNS cache flushed successfully.\"
|
Write-Output \"DNS cache flushed successfully.\"
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Error \"Failed to flush DNS cache. Error: $_\"
|
Write-Error \"Failed to flush DNS cache. Error: $_\"
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@ -2837,8 +2832,7 @@
|
|||||||
# Load the content of the HOSTS file
|
# Load the content of the HOSTS file
|
||||||
try {
|
try {
|
||||||
$hostsContent = Get-Content $localHostsPath -ErrorAction Stop
|
$hostsContent = Get-Content $localHostsPath -ErrorAction Stop
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Error \"Failed to load the HOSTS file. Error: $_\"
|
Write-Error \"Failed to load the HOSTS file. Error: $_\"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2864,8 +2858,7 @@
|
|||||||
try {
|
try {
|
||||||
$newContent | Set-Content $localHostsPath -Encoding ASCII
|
$newContent | Set-Content $localHostsPath -Encoding ASCII
|
||||||
Write-Output \"Successfully removed the AdobeNetBlock section from the HOSTS file.\"
|
Write-Output \"Successfully removed the AdobeNetBlock section from the HOSTS file.\"
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Error \"Failed to write back to the HOSTS file. Error: $_\"
|
Write-Error \"Failed to write back to the HOSTS file. Error: $_\"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2873,8 +2866,7 @@
|
|||||||
try {
|
try {
|
||||||
Invoke-Expression \"ipconfig /flushdns\"
|
Invoke-Expression \"ipconfig /flushdns\"
|
||||||
Write-Output \"DNS cache flushed successfully.\"
|
Write-Output \"DNS cache flushed successfully.\"
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Error \"Failed to flush DNS cache. Error: $_\"
|
Write-Error \"Failed to flush DNS cache. Error: $_\"
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
@ -86,8 +86,7 @@ function ConvertTo-Icon {
|
|||||||
$icon.Save($file)
|
$icon.Save($file)
|
||||||
$file.Close()
|
$file.Close()
|
||||||
$icon.Dispose()
|
$icon.Dispose()
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw [System.IO.FileNotFoundException] "[ConvertTo-Icon] The provided bitmap File Path is not found at '$bitmapPath'."
|
throw [System.IO.FileNotFoundException] "[ConvertTo-Icon] The provided bitmap File Path is not found at '$bitmapPath'."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ function Get-TabXaml {
|
|||||||
|
|
||||||
# else it is a checkbox
|
# else it is a checkbox
|
||||||
default {
|
default {
|
||||||
$checkedStatus = If ($appInfo.Checked -eq $null) {""} Else {" IsChecked=""$($appInfo.Checked)"""}
|
$checkedStatus = If ($appInfo.Checked -eq $null) {""} else {" IsChecked=""$($appInfo.Checked)"""}
|
||||||
if ($appInfo.Link -eq $null) {
|
if ($appInfo.Link -eq $null) {
|
||||||
$blockXml += $precal_indent +
|
$blockXml += $precal_indent +
|
||||||
"<CheckBox Name=""$($appInfo.Name)"" Content=""$($appInfo.Content)""$($checkedStatus) Margin=""5,0""" + " " +
|
"<CheckBox Name=""$($appInfo.Name)"" Content=""$($appInfo.Content)""$($checkedStatus) Margin=""5,0""" + " " +
|
||||||
|
@ -18,8 +18,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$system = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').SystemUsesLightTheme
|
$system = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').SystemUsesLightTheme
|
||||||
if($app -eq 0 -and $system -eq 0) {
|
if($app -eq 0 -and $system -eq 0) {
|
||||||
return $true
|
return $true
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,8 +26,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$bingsearch = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search').BingSearchEnabled
|
$bingsearch = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search').BingSearchEnabled
|
||||||
if($bingsearch -eq 0) {
|
if($bingsearch -eq 0) {
|
||||||
return $false
|
return $false
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -36,8 +34,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$numlockvalue = (Get-ItemProperty -path 'HKCU:\Control Panel\Keyboard').InitialKeyboardIndicators
|
$numlockvalue = (Get-ItemProperty -path 'HKCU:\Control Panel\Keyboard').InitialKeyboardIndicators
|
||||||
if($numlockvalue -eq 2) {
|
if($numlockvalue -eq 2) {
|
||||||
return $true
|
return $true
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,8 +42,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$VerboseStatusvalue = (Get-ItemProperty -path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System').VerboseStatus
|
$VerboseStatusvalue = (Get-ItemProperty -path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System').VerboseStatus
|
||||||
if($VerboseStatusvalue -eq 1) {
|
if($VerboseStatusvalue -eq 1) {
|
||||||
return $true
|
return $true
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,8 +50,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt
|
$hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt
|
||||||
if($hideextvalue -eq 0) {
|
if($hideextvalue -eq 0) {
|
||||||
return $true
|
return $true
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,8 +58,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
|
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
|
||||||
if($hidesnap -eq 0) {
|
if($hidesnap -eq 0) {
|
||||||
return $false
|
return $false
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,8 +66,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout
|
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout
|
||||||
if($hidesnap -eq 0) {
|
if($hidesnap -eq 0) {
|
||||||
return $false
|
return $false
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,8 +74,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
|
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
|
||||||
if($hidesnap -eq 0) {
|
if($hidesnap -eq 0) {
|
||||||
return $false
|
return $false
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,8 +85,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
|
|
||||||
if($MouseSpeed -eq 1 -and $MouseThreshold1 -eq 6 -and $MouseThreshold2 -eq 10) {
|
if($MouseSpeed -eq 1 -and $MouseThreshold1 -eq 6 -and $MouseThreshold2 -eq 10) {
|
||||||
return $true
|
return $true
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,8 +93,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$SearchButton = (Get-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search").SearchboxTaskbarMode
|
$SearchButton = (Get-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search").SearchboxTaskbarMode
|
||||||
if($SearchButton -eq 0) {
|
if($SearchButton -eq 0) {
|
||||||
return $false
|
return $false
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,8 +101,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags
|
$StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags
|
||||||
if($StickyKeys -eq 58) {
|
if($StickyKeys -eq 58) {
|
||||||
return $false
|
return $false
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,8 +109,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$TaskView = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').ShowTaskViewButton
|
$TaskView = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').ShowTaskViewButton
|
||||||
if($TaskView -eq 0) {
|
if($TaskView -eq 0) {
|
||||||
return $false
|
return $false
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,8 +118,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden
|
$HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden
|
||||||
if($HiddenFiles -eq 0) {
|
if($HiddenFiles -eq 0) {
|
||||||
return $false
|
return $false
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,8 +127,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
|
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
|
||||||
if($TaskbarWidgets -eq 0) {
|
if($TaskbarWidgets -eq 0) {
|
||||||
return $false
|
return $false
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,8 +135,7 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$TaskbarAlignment = (Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskbarAl
|
$TaskbarAlignment = (Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskbarAl
|
||||||
if($TaskbarAlignment -eq 0) {
|
if($TaskbarAlignment -eq 0) {
|
||||||
return $false
|
return $false
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,12 @@ function Get-WinUtilVariables {
|
|||||||
$keys = ($sync.keys).where{ $_ -like "WPF*" }
|
$keys = ($sync.keys).where{ $_ -like "WPF*" }
|
||||||
if ($Type) {
|
if ($Type) {
|
||||||
$output = $keys | ForEach-Object {
|
$output = $keys | ForEach-Object {
|
||||||
Try {
|
try {
|
||||||
$objType = $sync["$psitem"].GetType().Name
|
$objType = $sync["$psitem"].GetType().Name
|
||||||
if ($Type -contains $objType) {
|
if ($Type -contains $objType) {
|
||||||
Write-Output $psitem
|
Write-Output $psitem
|
||||||
}
|
}
|
||||||
}
|
} catch {
|
||||||
Catch {
|
|
||||||
<#I am here so errors don't get outputted for a couple variables that don't have the .GetType() attribute#>
|
<#I am here so errors don't get outputted for a couple variables that don't have the .GetType() attribute#>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ function Get-WinUtilWingetLatest {
|
|||||||
# Invoke-WebRequest is notoriously slow when the byte progress is displayed. The following lines disable the progress bar and reset them at the end of the function
|
# Invoke-WebRequest is notoriously slow when the byte progress is displayed. The following lines disable the progress bar and reset them at the end of the function
|
||||||
$PreviousProgressPreference = $ProgressPreference
|
$PreviousProgressPreference = $ProgressPreference
|
||||||
$ProgressPreference = "silentlyContinue"
|
$ProgressPreference = "silentlyContinue"
|
||||||
Try{
|
try {
|
||||||
# Grabs the latest release of Winget from the Github API for the install process.
|
# Grabs the latest release of Winget from the Github API for the install process.
|
||||||
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/Winget-cli/releases/latest" -Method Get -ErrorAction Stop
|
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/Winget-cli/releases/latest" -Method Get -ErrorAction Stop
|
||||||
$latestVersion = $response.tag_name #Stores version number of latest release.
|
$latestVersion = $response.tag_name #Stores version number of latest release.
|
||||||
@ -19,8 +19,7 @@ function Get-WinUtilWingetLatest {
|
|||||||
Invoke-WebRequest -Uri $licenseWingetUrl -OutFile $ENV:TEMP\License1.xml
|
Invoke-WebRequest -Uri $licenseWingetUrl -OutFile $ENV:TEMP\License1.xml
|
||||||
# The only pain is that the msixbundle for winget-cli is 246MB. In some situations this can take a bit, with slower connections.
|
# The only pain is that the msixbundle for winget-cli is 246MB. In some situations this can take a bit, with slower connections.
|
||||||
Invoke-WebRequest -Uri $assetUrl -OutFile $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle
|
Invoke-WebRequest -Uri $assetUrl -OutFile $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
throw [WingetFailedInstall]::new('Failed to get latest Winget release and license')
|
throw [WingetFailedInstall]::new('Failed to get latest Winget release and license')
|
||||||
}
|
}
|
||||||
$ProgressPreference = $PreviousProgressPreference
|
$ProgressPreference = $PreviousProgressPreference
|
||||||
|
@ -17,13 +17,12 @@ function Get-WinUtilWingetPrerequisites {
|
|||||||
$fileUIXaml = "https://github.com/microsoft/microsoft-ui-xaml/releases/download/v${versionUIXamlPatch}/Microsoft.UI.Xaml.${versionUIXamlMinor}.x64.appx"
|
$fileUIXaml = "https://github.com/microsoft/microsoft-ui-xaml/releases/download/v${versionUIXamlPatch}/Microsoft.UI.Xaml.${versionUIXamlMinor}.x64.appx"
|
||||||
# Write-Host "$fileUIXaml"
|
# Write-Host "$fileUIXaml"
|
||||||
|
|
||||||
Try{
|
try {
|
||||||
Write-Host "Downloading Microsoft.VCLibs Dependency..."
|
Write-Host "Downloading Microsoft.VCLibs Dependency..."
|
||||||
Invoke-WebRequest -Uri $fileVCLibs -OutFile $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx
|
Invoke-WebRequest -Uri $fileVCLibs -OutFile $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx
|
||||||
Write-Host "Downloading Microsoft.UI.Xaml Dependency...`n"
|
Write-Host "Downloading Microsoft.UI.Xaml Dependency...`n"
|
||||||
Invoke-WebRequest -Uri $fileUIXaml -OutFile $ENV:TEMP\Microsoft.UI.Xaml.x64.appx
|
Invoke-WebRequest -Uri $fileUIXaml -OutFile $ENV:TEMP\Microsoft.UI.Xaml.x64.appx
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
throw [WingetFailedInstall]::new('Failed to install prerequsites')
|
throw [WingetFailedInstall]::new('Failed to install prerequsites')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,7 @@ function Install-WinUtilChoco {
|
|||||||
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
|
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
|
||||||
powershell choco feature enable -n allowGlobalConfirmation
|
powershell choco feature enable -n allowGlobalConfirmation
|
||||||
|
|
||||||
}
|
} catch {
|
||||||
Catch {
|
|
||||||
Write-Host "===========================================" -Foregroundcolor Red
|
Write-Host "===========================================" -Foregroundcolor Red
|
||||||
Write-Host "-- Chocolatey failed to install ---" -Foregroundcolor Red
|
Write-Host "-- Chocolatey failed to install ---" -Foregroundcolor Red
|
||||||
Write-Host "===========================================" -Foregroundcolor Red
|
Write-Host "===========================================" -Foregroundcolor Red
|
||||||
|
@ -30,8 +30,7 @@ Function Install-WinUtilProgramWinget {
|
|||||||
Write-Host "-- Configuring winget packages ---"
|
Write-Host "-- Configuring winget packages ---"
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
for ($i = 0; $i -lt $count; $i++) {
|
for ($i = 0; $i -lt $count; $i++) {
|
||||||
$Program = $ProgramsToInstall[$i]
|
$Program = $ProgramsToInstall[$i]$failedPackages = @()
|
||||||
$failedPackages = @()
|
|
||||||
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($i + 1) of $count" -PercentComplete $((($i + 1)/$count) * 100)
|
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($i + 1) of $count" -PercentComplete $((($i + 1)/$count) * 100)
|
||||||
if($manage -eq "Installing") {
|
if($manage -eq "Installing") {
|
||||||
# Install package via ID, if it fails try again with different scope and then with an unelevated prompt.
|
# Install package via ID, if it fails try again with different scope and then with an unelevated prompt.
|
||||||
@ -106,8 +105,7 @@ Function Install-WinUtilProgramWinget {
|
|||||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
||||||
}
|
}
|
||||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$count) })
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw "[Install-WinUtilProgramWinget] Invalid Value for Parameter 'manage', Provided Value is: $manage"
|
throw "[Install-WinUtilProgramWinget] Invalid Value for Parameter 'manage', Provided Value is: $manage"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ function Install-WinUtilWinget {
|
|||||||
#>
|
#>
|
||||||
$isWingetInstalled = Test-WinUtilPackageManager -winget
|
$isWingetInstalled = Test-WinUtilPackageManager -winget
|
||||||
|
|
||||||
Try {
|
try {
|
||||||
if ($isWingetInstalled -eq "installed") {
|
if ($isWingetInstalled -eq "installed") {
|
||||||
Write-Host "`nWinget is already installed.`r" -ForegroundColor Green
|
Write-Host "`nWinget is already installed.`r" -ForegroundColor Green
|
||||||
return
|
return
|
||||||
@ -50,17 +50,17 @@ function Install-WinUtilWinget {
|
|||||||
# Winget only needs a refresh of the environment variables to be used.
|
# 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 {
|
} catch {
|
||||||
Write-Host "Failure detected while installing via GitHub method. Continuing with Chocolatey method as fallback." -ForegroundColor Red
|
Write-Host "Failure detected while installing via GitHub method. Continuing with Chocolatey method as fallback." -ForegroundColor Red
|
||||||
# In case install fails via GitHub method.
|
# In case install fails via GitHub method.
|
||||||
Try {
|
try {
|
||||||
# Install Choco if not already present
|
# Install Choco if not already present
|
||||||
Install-WinUtilChoco
|
Install-WinUtilChoco
|
||||||
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget-cli"
|
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget-cli"
|
||||||
Write-Host "Winget Installed" -ForegroundColor Green
|
Write-Host "Winget Installed" -ForegroundColor Green
|
||||||
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 {
|
} catch {
|
||||||
throw [WingetFailedInstall]::new('Failed to install!')
|
throw [WingetFailedInstall]::new('Failed to install!')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,7 @@ function Remove-Features([switch] $dumpFeatures = $false, [switch] $keepDefender
|
|||||||
}
|
}
|
||||||
Write-Progress -Activity "Removing features" -Status "Ready" -Completed
|
Write-Progress -Activity "Removing features" -Status "Ready" -Completed
|
||||||
Write-Host "You can re-enable the disabled features at any time, using either Windows Update or the SxS folder in <installation media>\Sources."
|
Write-Host "You can re-enable the disabled features at any time, using either Windows Update or the SxS folder in <installation media>\Sources."
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Host "Unable to get information about the features. MicroWin processing will continue, but features will not be processed"
|
Write-Host "Unable to get information about the features. MicroWin processing will continue, but features will not be processed"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,16 +114,14 @@ function Remove-Packages {
|
|||||||
$status = "Removing $pkg"
|
$status = "Removing $pkg"
|
||||||
Write-Progress -Activity "Removing Apps" -Status $status -PercentComplete ($counter++/$pkglist.Count*100)
|
Write-Progress -Activity "Removing Apps" -Status $status -PercentComplete ($counter++/$pkglist.Count*100)
|
||||||
Remove-WindowsPackage -Path "$scratchDir" -PackageName $pkg -NoRestart -ErrorAction SilentlyContinue
|
Remove-WindowsPackage -Path "$scratchDir" -PackageName $pkg -NoRestart -ErrorAction SilentlyContinue
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
# This can happen if the package that is being removed is a permanent one, like FodMetadata
|
# This can happen if the package that is being removed is a permanent one, like FodMetadata
|
||||||
Write-Host "Could not remove OS package $($pkg)"
|
Write-Host "Could not remove OS package $($pkg)"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed
|
Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Host "Unable to get information about the packages. MicroWin processing will continue, but packages will not be processed"
|
Write-Host "Unable to get information about the packages. MicroWin processing will continue, but packages will not be processed"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,15 +158,13 @@ function Remove-ProvisionedPackages([switch] $keepSecurity = $false) {
|
|||||||
Write-Progress -Activity "Removing Provisioned Apps" -Status $status -PercentComplete ($counter++/$appxProvisionedPackages.Count*100)
|
Write-Progress -Activity "Removing Provisioned Apps" -Status $status -PercentComplete ($counter++/$appxProvisionedPackages.Count*100)
|
||||||
try {
|
try {
|
||||||
Remove-AppxProvisionedPackage -Path $scratchDir -PackageName $appx.PackageName -ErrorAction SilentlyContinue
|
Remove-AppxProvisionedPackage -Path $scratchDir -PackageName $appx.PackageName -ErrorAction SilentlyContinue
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Host "Application $($appx.PackageName) could not be removed"
|
Write-Host "Application $($appx.PackageName) could not be removed"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed
|
Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Could not get Provisioned App information. Skipping process..."
|
Write-Host "Could not get Provisioned App information. Skipping process..."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,11 +221,9 @@ function Remove-FileOrDirectory([string] $pathToDelete, [string] $mask = "", [sw
|
|||||||
if ($mask -eq "") {
|
if ($mask -eq "") {
|
||||||
Write-Debug "Adding $($pathToDelete) to array."
|
Write-Debug "Adding $($pathToDelete) to array."
|
||||||
[void]$itemsToDelete.Add($pathToDelete)
|
[void]$itemsToDelete.Add($pathToDelete)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Debug "Adding $($pathToDelete) to array and mask is $($mask)"
|
Write-Debug "Adding $($pathToDelete) to array and mask is $($mask)"
|
||||||
if ($Directory) { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse -Directory }
|
if ($Directory) { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse -Directory } else { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse }
|
||||||
else { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($itemToDelete in $itemsToDelete) {
|
foreach($itemToDelete in $itemsToDelete) {
|
||||||
@ -360,8 +353,7 @@ function New-Unattend {
|
|||||||
if ((Test-CompatibleImage $imgVersion $([System.Version]::new(10,0,22000,1))) -eq $false) {
|
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
|
# Replace the placeholder text with an empty string to make it valid for Windows 10 Setup
|
||||||
$unattend = $unattend.Replace("<#REPLACEME#>", "").Trim()
|
$unattend = $unattend.Replace("<#REPLACEME#>", "").Trim()
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
# Replace the placeholder text with the Specialize pass
|
# Replace the placeholder text with the Specialize pass
|
||||||
$unattend = $unattend.Replace("<#REPLACEME#>", $specPass).Trim()
|
$unattend = $unattend.Replace("<#REPLACEME#>", $specPass).Trim()
|
||||||
}
|
}
|
||||||
@ -466,12 +458,10 @@ function New-FirstRun {
|
|||||||
# Remove the registry value
|
# Remove the registry value
|
||||||
Remove-ItemProperty -Path $RegistryPath -Name $ValueName -Force
|
Remove-ItemProperty -Path $RegistryPath -Name $ValueName -Force
|
||||||
Write-Host "Registry value '$ValueName' removed from '$RegistryPath'."
|
Write-Host "Registry value '$ValueName' removed from '$RegistryPath'."
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Registry value '$ValueName' not found in '$RegistryPath'."
|
Write-Host "Registry value '$ValueName' not found in '$RegistryPath'."
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Registry path '$RegistryPath' not found."
|
Write-Host "Registry path '$RegistryPath' not found."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,25 +9,21 @@ function Invoke-WinUtilBingSearch {
|
|||||||
|
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try{
|
try {
|
||||||
if ($Enabled -eq $false) {
|
if ($Enabled -eq $false) {
|
||||||
Write-Host "Enabling Bing Search"
|
Write-Host "Enabling Bing Search"
|
||||||
$value = 1
|
$value = 1
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Disabling Bing Search"
|
Write-Host "Disabling Bing Search"
|
||||||
$value = 0
|
$value = 0
|
||||||
}
|
}
|
||||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search"
|
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search"
|
||||||
Set-ItemProperty -Path $Path -Name BingSearchEnabled -Value $value
|
Set-ItemProperty -Path $Path -Name BingSearchEnabled -Value $value
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,7 @@ Function Invoke-WinUtilCurrentSystem {
|
|||||||
if ($expectedValue -notlike $actualValue) {
|
if ($expectedValue -notlike $actualValue) {
|
||||||
$values += $False
|
$values += $False
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$values += $False
|
$values += $False
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,4 +98,3 @@ Function Invoke-WinUtilCurrentSystem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,12 +9,11 @@ Function Invoke-WinUtilDarkMode {
|
|||||||
|
|
||||||
#>
|
#>
|
||||||
Param($DarkMoveEnabled)
|
Param($DarkMoveEnabled)
|
||||||
Try{
|
try {
|
||||||
if ($DarkMoveEnabled -eq $false) {
|
if ($DarkMoveEnabled -eq $false) {
|
||||||
Write-Host "Enabling Dark Mode"
|
Write-Host "Enabling Dark Mode"
|
||||||
$DarkMoveValue = 0
|
$DarkMoveValue = 0
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Disabling Dark Mode"
|
Write-Host "Disabling Dark Mode"
|
||||||
$DarkMoveValue = 1
|
$DarkMoveValue = 1
|
||||||
}
|
}
|
||||||
@ -22,14 +21,11 @@ Function Invoke-WinUtilDarkMode {
|
|||||||
$Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
$Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
||||||
Set-ItemProperty -Path $Path -Name AppsUseLightTheme -Value $DarkMoveValue
|
Set-ItemProperty -Path $Path -Name AppsUseLightTheme -Value $DarkMoveValue
|
||||||
Set-ItemProperty -Path $Path -Name SystemUsesLightTheme -Value $DarkMoveValue
|
Set-ItemProperty -Path $Path -Name SystemUsesLightTheme -Value $DarkMoveValue
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -15,17 +15,14 @@ function Invoke-WinUtilFeatureInstall {
|
|||||||
$CheckBox | ForEach-Object {
|
$CheckBox | ForEach-Object {
|
||||||
if($sync.configs.feature.$psitem.feature) {
|
if($sync.configs.feature.$psitem.feature) {
|
||||||
Foreach( $feature in $sync.configs.feature.$psitem.feature ) {
|
Foreach( $feature in $sync.configs.feature.$psitem.feature ) {
|
||||||
Try{
|
try {
|
||||||
Write-Host "Installing $feature"
|
Write-Host "Installing $feature"
|
||||||
Enable-WindowsOptionalFeature -Online -FeatureName $feature -All -NoRestart
|
Enable-WindowsOptionalFeature -Online -FeatureName $feature -All -NoRestart
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
if ($psitem.Exception.Message -like "*requires elevation*") {
|
if ($psitem.Exception.Message -like "*requires elevation*") {
|
||||||
Write-Warning "Unable to Install $feature due to permissions. Are you running as admin?"
|
Write-Warning "Unable to Install $feature due to permissions. Are you running as admin?"
|
||||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else{
|
|
||||||
|
|
||||||
Write-Warning "Unable to Install $feature due to unhandled exception"
|
Write-Warning "Unable to Install $feature due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
@ -35,19 +32,16 @@ function Invoke-WinUtilFeatureInstall {
|
|||||||
}
|
}
|
||||||
if($sync.configs.feature.$psitem.InvokeScript) {
|
if($sync.configs.feature.$psitem.InvokeScript) {
|
||||||
Foreach( $script in $sync.configs.feature.$psitem.InvokeScript ) {
|
Foreach( $script in $sync.configs.feature.$psitem.InvokeScript ) {
|
||||||
Try{
|
try {
|
||||||
$Scriptblock = [scriptblock]::Create($script)
|
$Scriptblock = [scriptblock]::Create($script)
|
||||||
|
|
||||||
Write-Host "Running Script for $psitem"
|
Write-Host "Running Script for $psitem"
|
||||||
Invoke-Command $scriptblock -ErrorAction stop
|
Invoke-Command $scriptblock -ErrorAction stop
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
if ($psitem.Exception.Message -like "*requires elevation*") {
|
if ($psitem.Exception.Message -like "*requires elevation*") {
|
||||||
Write-Warning "Unable to Install $feature due to permissions. Are you running as admin?"
|
Write-Warning "Unable to Install $feature due to permissions. Are you running as admin?"
|
||||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else{
|
|
||||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
||||||
Write-Warning "Unable to Install $feature due to unhandled exception"
|
Write-Warning "Unable to Install $feature due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
|
@ -9,25 +9,21 @@ function Invoke-WinUtilHiddenFiles {
|
|||||||
|
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try{
|
try {
|
||||||
if ($Enabled -eq $false) {
|
if ($Enabled -eq $false) {
|
||||||
Write-Host "Enabling Hidden Files"
|
Write-Host "Enabling Hidden Files"
|
||||||
$value = 1
|
$value = 1
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Disabling Hidden Files"
|
Write-Host "Disabling Hidden Files"
|
||||||
$value = 0
|
$value = 0
|
||||||
}
|
}
|
||||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||||
Set-ItemProperty -Path $Path -Name Hidden -Value $value
|
Set-ItemProperty -Path $Path -Name Hidden -Value $value
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,13 @@ Function Invoke-WinUtilMouseAcceleration {
|
|||||||
|
|
||||||
#>
|
#>
|
||||||
Param($MouseAccelerationEnabled)
|
Param($MouseAccelerationEnabled)
|
||||||
Try{
|
try {
|
||||||
if ($MouseAccelerationEnabled -eq $false) {
|
if ($MouseAccelerationEnabled -eq $false) {
|
||||||
Write-Host "Enabling Mouse Acceleration"
|
Write-Host "Enabling Mouse Acceleration"
|
||||||
$MouseSpeed = 1
|
$MouseSpeed = 1
|
||||||
$MouseThreshold1 = 6
|
$MouseThreshold1 = 6
|
||||||
$MouseThreshold2 = 10
|
$MouseThreshold2 = 10
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Disabling Mouse Acceleration"
|
Write-Host "Disabling Mouse Acceleration"
|
||||||
$MouseSpeed = 0
|
$MouseSpeed = 0
|
||||||
$MouseThreshold1 = 0
|
$MouseThreshold1 = 0
|
||||||
@ -28,14 +27,11 @@ Function Invoke-WinUtilMouseAcceleration {
|
|||||||
Set-ItemProperty -Path $Path -Name MouseSpeed -Value $MouseSpeed
|
Set-ItemProperty -Path $Path -Name MouseSpeed -Value $MouseSpeed
|
||||||
Set-ItemProperty -Path $Path -Name MouseThreshold1 -Value $MouseThreshold1
|
Set-ItemProperty -Path $Path -Name MouseThreshold1 -Value $MouseThreshold1
|
||||||
Set-ItemProperty -Path $Path -Name MouseThreshold2 -Value $MouseThreshold2
|
Set-ItemProperty -Path $Path -Name MouseThreshold2 -Value $MouseThreshold2
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -6,26 +6,22 @@ function Invoke-WinUtilNumLock {
|
|||||||
Indicates whether to enable or disable Numlock on startup
|
Indicates whether to enable or disable Numlock on startup
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try{
|
try {
|
||||||
if ($Enabled -eq $false) {
|
if ($Enabled -eq $false) {
|
||||||
Write-Host "Enabling Numlock on startup"
|
Write-Host "Enabling Numlock on startup"
|
||||||
$value = 2
|
$value = 2
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Disabling Numlock on startup"
|
Write-Host "Disabling Numlock on startup"
|
||||||
$value = 0
|
$value = 0
|
||||||
}
|
}
|
||||||
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS
|
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS
|
||||||
$Path = "HKU:\.Default\Control Panel\Keyboard"
|
$Path = "HKU:\.Default\Control Panel\Keyboard"
|
||||||
Set-ItemProperty -Path $Path -Name InitialKeyboardIndicators -Value $value
|
Set-ItemProperty -Path $Path -Name InitialKeyboardIndicators -Value $value
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -20,27 +20,22 @@ function Invoke-WinUtilScript {
|
|||||||
[scriptblock]$scriptblock
|
[scriptblock]$scriptblock
|
||||||
)
|
)
|
||||||
|
|
||||||
Try {
|
try {
|
||||||
Write-Host "Running Script for $name"
|
Write-Host "Running Script for $name"
|
||||||
Invoke-Command $scriptblock -ErrorAction Stop
|
Invoke-Command $scriptblock -ErrorAction Stop
|
||||||
}
|
} catch [System.Management.Automation.CommandNotFoundException] {
|
||||||
Catch [System.Management.Automation.CommandNotFoundException] {
|
|
||||||
Write-Warning "The specified command was not found."
|
Write-Warning "The specified command was not found."
|
||||||
Write-Warning $PSItem.Exception.message
|
Write-Warning $PSItem.Exception.message
|
||||||
}
|
} catch [System.Management.Automation.RuntimeException] {
|
||||||
Catch [System.Management.Automation.RuntimeException] {
|
|
||||||
Write-Warning "A runtime exception occurred."
|
Write-Warning "A runtime exception occurred."
|
||||||
Write-Warning $PSItem.Exception.message
|
Write-Warning $PSItem.Exception.message
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "A security exception occurred."
|
Write-Warning "A security exception occurred."
|
||||||
Write-Warning $PSItem.Exception.message
|
Write-Warning $PSItem.Exception.message
|
||||||
}
|
} catch [System.UnauthorizedAccessException] {
|
||||||
Catch [System.UnauthorizedAccessException] {
|
|
||||||
Write-Warning "Access denied. You do not have permission to perform this operation."
|
Write-Warning "Access denied. You do not have permission to perform this operation."
|
||||||
Write-Warning $PSItem.Exception.message
|
Write-Warning $PSItem.Exception.message
|
||||||
}
|
} catch {
|
||||||
Catch {
|
|
||||||
# Generic catch block to handle any other type of exception
|
# Generic catch block to handle any other type of exception
|
||||||
Write-Warning "Unable to run script for $name due to unhandled exception"
|
Write-Warning "Unable to run script for $name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
|
@ -6,25 +6,21 @@ function Invoke-WinUtilShowExt {
|
|||||||
Indicates whether to enable or disable Show file extentions
|
Indicates whether to enable or disable Show file extentions
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try{
|
try {
|
||||||
if ($Enabled -eq $false) {
|
if ($Enabled -eq $false) {
|
||||||
Write-Host "Showing file extentions"
|
Write-Host "Showing file extentions"
|
||||||
$value = 0
|
$value = 0
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "hiding file extensions"
|
Write-Host "hiding file extensions"
|
||||||
$value = 1
|
$value = 1
|
||||||
}
|
}
|
||||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||||
Set-ItemProperty -Path $Path -Name HideFileExt -Value $value
|
Set-ItemProperty -Path $Path -Name HideFileExt -Value $value
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,11 @@ function Invoke-WinUtilSnapFlyout {
|
|||||||
Indicates whether to enable or disable Snap Assist Flyout on startup
|
Indicates whether to enable or disable Snap Assist Flyout on startup
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try{
|
try {
|
||||||
if ($Enabled -eq $false) {
|
if ($Enabled -eq $false) {
|
||||||
Write-Host "Enabling Snap Assist Flyout On startup"
|
Write-Host "Enabling Snap Assist Flyout On startup"
|
||||||
$value = 1
|
$value = 1
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Disabling Snap Assist Flyout On startup"
|
Write-Host "Disabling Snap Assist Flyout On startup"
|
||||||
$value = 0
|
$value = 0
|
||||||
}
|
}
|
||||||
@ -20,14 +19,11 @@ function Invoke-WinUtilSnapFlyout {
|
|||||||
taskkill.exe /F /IM "explorer.exe"
|
taskkill.exe /F /IM "explorer.exe"
|
||||||
Set-ItemProperty -Path $Path -Name EnableSnapAssistFlyout -Value $value
|
Set-ItemProperty -Path $Path -Name EnableSnapAssistFlyout -Value $value
|
||||||
Start-Process "explorer.exe"
|
Start-Process "explorer.exe"
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,11 @@ function Invoke-WinUtilSnapSuggestion {
|
|||||||
Indicates whether to enable or disable Snap Assist Suggestions on startup
|
Indicates whether to enable or disable Snap Assist Suggestions on startup
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try{
|
try {
|
||||||
if ($Enabled -eq $false) {
|
if ($Enabled -eq $false) {
|
||||||
Write-Host "Enabling Snap Assist Suggestion On startup"
|
Write-Host "Enabling Snap Assist Suggestion On startup"
|
||||||
$value = 1
|
$value = 1
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Disabling Snap Assist Suggestion On startup"
|
Write-Host "Disabling Snap Assist Suggestion On startup"
|
||||||
$value = 0
|
$value = 0
|
||||||
}
|
}
|
||||||
@ -20,14 +19,11 @@ function Invoke-WinUtilSnapSuggestion {
|
|||||||
taskkill.exe /F /IM "explorer.exe"
|
taskkill.exe /F /IM "explorer.exe"
|
||||||
Set-ItemProperty -Path $Path -Name SnapAssist -Value $value
|
Set-ItemProperty -Path $Path -Name SnapAssist -Value $value
|
||||||
Start-Process "explorer.exe"
|
Start-Process "explorer.exe"
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -6,25 +6,21 @@ function Invoke-WinUtilSnapWindow {
|
|||||||
Indicates whether to enable or disable Snapping Windows on startup
|
Indicates whether to enable or disable Snapping Windows on startup
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try{
|
try {
|
||||||
if ($Enabled -eq $false) {
|
if ($Enabled -eq $false) {
|
||||||
Write-Host "Enabling Snap Windows On startup | Relogin Required"
|
Write-Host "Enabling Snap Windows On startup | Relogin Required"
|
||||||
$value = 1
|
$value = 1
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Disabling Snap Windows On startup | Relogin Required"
|
Write-Host "Disabling Snap Windows On startup | Relogin Required"
|
||||||
$value = 0
|
$value = 0
|
||||||
}
|
}
|
||||||
$Path = "HKCU:\Control Panel\Desktop"
|
$Path = "HKCU:\Control Panel\Desktop"
|
||||||
Set-ItemProperty -Path $Path -Name WindowArrangementActive -Value $value
|
Set-ItemProperty -Path $Path -Name WindowArrangementActive -Value $value
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,7 @@ Function Invoke-WinUtilSponsors {
|
|||||||
|
|
||||||
# Return the sponsors
|
# Return the sponsors
|
||||||
return $sponsors
|
return $sponsors
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Error "An error occurred while fetching or processing the sponsors: $_"
|
Write-Error "An error occurred while fetching or processing the sponsors: $_"
|
||||||
return $null
|
return $null
|
||||||
}
|
}
|
||||||
|
@ -6,25 +6,21 @@ Function Invoke-WinUtilStickyKeys {
|
|||||||
Indicates whether to enable or disable Sticky Keys on startup
|
Indicates whether to enable or disable Sticky Keys on startup
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try {
|
try {
|
||||||
if ($Enabled -eq $false) {
|
if ($Enabled -eq $false) {
|
||||||
Write-Host "Enabling Sticky Keys On startup"
|
Write-Host "Enabling Sticky Keys On startup"
|
||||||
$value = 510
|
$value = 510
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Disabling Sticky Keys On startup"
|
Write-Host "Disabling Sticky Keys On startup"
|
||||||
$value = 58
|
$value = 58
|
||||||
}
|
}
|
||||||
$Path = "HKCU:\Control Panel\Accessibility\StickyKeys"
|
$Path = "HKCU:\Control Panel\Accessibility\StickyKeys"
|
||||||
Set-ItemProperty -Path $Path -Name Flags -Value $value
|
Set-ItemProperty -Path $Path -Name Flags -Value $value
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -9,25 +9,21 @@ function Invoke-WinUtilTaskView {
|
|||||||
|
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try{
|
try {
|
||||||
if ($Enabled -eq $false) {
|
if ($Enabled -eq $false) {
|
||||||
Write-Host "Enabling Task View"
|
Write-Host "Enabling Task View"
|
||||||
$value = 1
|
$value = 1
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Disabling Task View"
|
Write-Host "Disabling Task View"
|
||||||
$value = 0
|
$value = 0
|
||||||
}
|
}
|
||||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||||
Set-ItemProperty -Path $Path -Name ShowTaskViewButton -Value $value
|
Set-ItemProperty -Path $Path -Name ShowTaskViewButton -Value $value
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -9,25 +9,21 @@ function Invoke-WinUtilTaskbarAlignment {
|
|||||||
|
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try{
|
try {
|
||||||
if ($Enabled -eq $false) {
|
if ($Enabled -eq $false) {
|
||||||
Write-Host "Making Taskbar Alignment to the Center"
|
Write-Host "Making Taskbar Alignment to the Center"
|
||||||
$value = 1
|
$value = 1
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Making Taskbar Alignment to the Left"
|
Write-Host "Making Taskbar Alignment to the Left"
|
||||||
$value = 0
|
$value = 0
|
||||||
}
|
}
|
||||||
$Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
$Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||||
Set-ItemProperty -Path $Path -Name "TaskbarAl" -Value $value
|
Set-ItemProperty -Path $Path -Name "TaskbarAl" -Value $value
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -9,25 +9,21 @@ function Invoke-WinUtilTaskbarSearch {
|
|||||||
|
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try{
|
try {
|
||||||
if ($Enabled -eq $false) {
|
if ($Enabled -eq $false) {
|
||||||
Write-Host "Enabling Search Button"
|
Write-Host "Enabling Search Button"
|
||||||
$value = 1
|
$value = 1
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Disabling Search Button"
|
Write-Host "Disabling Search Button"
|
||||||
$value = 0
|
$value = 0
|
||||||
}
|
}
|
||||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search\"
|
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search\"
|
||||||
Set-ItemProperty -Path $Path -Name SearchboxTaskbarMode -Value $value
|
Set-ItemProperty -Path $Path -Name SearchboxTaskbarMode -Value $value
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -9,25 +9,21 @@ function Invoke-WinUtilTaskbarWidgets {
|
|||||||
|
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try{
|
try {
|
||||||
if ($Enabled -eq $false) {
|
if ($Enabled -eq $false) {
|
||||||
Write-Host "Enabling Taskbar Widgets"
|
Write-Host "Enabling Taskbar Widgets"
|
||||||
$value = 1
|
$value = 1
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Disabling Taskbar Widgets"
|
Write-Host "Disabling Taskbar Widgets"
|
||||||
$value = 0
|
$value = 0
|
||||||
}
|
}
|
||||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||||
Set-ItemProperty -Path $Path -Name TaskbarDa -Value $value
|
Set-ItemProperty -Path $Path -Name TaskbarDa -Value $value
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,7 @@ function Invoke-WinUtilTweaks {
|
|||||||
ScriptType = "UndoScript"
|
ScriptType = "UndoScript"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
Else{
|
|
||||||
$Values = @{
|
$Values = @{
|
||||||
Registry = "Value"
|
Registry = "Value"
|
||||||
ScheduledTask = "State"
|
ScheduledTask = "State"
|
||||||
@ -60,8 +59,7 @@ function Invoke-WinUtilTweaks {
|
|||||||
Write-Debug "Service $($service.Name) was changed in the past to $($service.StartType.ToString()) from it's original type of $($psitem.$($values.OriginalService)), will not change it to $($psitem.$($values.service))"
|
Write-Debug "Service $($service.Name) was changed in the past to $($service.StartType.ToString()) from it's original type of $($psitem.$($values.OriginalService)), will not change it to $($psitem.$($values.service))"
|
||||||
$changeservice = $false
|
$changeservice = $false
|
||||||
}
|
}
|
||||||
}
|
} catch [System.ServiceProcess.ServiceNotFoundException] {
|
||||||
catch [System.ServiceProcess.ServiceNotFoundException] {
|
|
||||||
Write-Warning "Service $($psitem.Name) was not found"
|
Write-Warning "Service $($psitem.Name) was not found"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,25 +6,21 @@ function Invoke-WinUtilVerboseLogon {
|
|||||||
Indicates whether to enable or disable VerboseLogon messages
|
Indicates whether to enable or disable VerboseLogon messages
|
||||||
#>
|
#>
|
||||||
Param($Enabled)
|
Param($Enabled)
|
||||||
Try{
|
try {
|
||||||
if ($Enabled -eq $false) {
|
if ($Enabled -eq $false) {
|
||||||
Write-Host "Enabling Verbose Logon Messages"
|
Write-Host "Enabling Verbose Logon Messages"
|
||||||
$value = 1
|
$value = 1
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Disabling Verbose Logon Messages"
|
Write-Host "Disabling Verbose Logon Messages"
|
||||||
$value = 0
|
$value = 0
|
||||||
}
|
}
|
||||||
$Path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
|
$Path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
|
||||||
Set-ItemProperty -Path $Path -Name VerboseStatus -Value $value
|
Set-ItemProperty -Path $Path -Name VerboseStatus -Value $value
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -15,21 +15,18 @@ function Remove-WinUtilAPPX {
|
|||||||
$Name
|
$Name
|
||||||
)
|
)
|
||||||
|
|
||||||
Try {
|
try {
|
||||||
Write-Host "Removing $Name"
|
Write-Host "Removing $Name"
|
||||||
Get-AppxPackage "*$Name*" | Remove-AppxPackage -ErrorAction SilentlyContinue
|
Get-AppxPackage "*$Name*" | Remove-AppxPackage -ErrorAction SilentlyContinue
|
||||||
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like "*$Name*" | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
|
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like "*$Name*" | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
|
||||||
}
|
} catch [System.Exception] {
|
||||||
Catch [System.Exception] {
|
|
||||||
if ($psitem.Exception.Message -like "*The requested operation requires elevation*") {
|
if ($psitem.Exception.Message -like "*The requested operation requires elevation*") {
|
||||||
Write-Warning "Unable to uninstall $name due to a Security Exception"
|
Write-Warning "Unable to uninstall $name due to a Security Exception"
|
||||||
|
} else {
|
||||||
|
Write-Warning "Unable to uninstall $name due to unhandled exception"
|
||||||
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
else {
|
} catch {
|
||||||
Write-Warning "Unable to uninstall $name due to unhandled exception"
|
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to uninstall $name due to unhandled exception"
|
Write-Warning "Unable to uninstall $name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ function Set-WinUtilDNS {
|
|||||||
#>
|
#>
|
||||||
param($DNSProvider)
|
param($DNSProvider)
|
||||||
if($DNSProvider -eq "Default") {return}
|
if($DNSProvider -eq "Default") {return}
|
||||||
Try{
|
try {
|
||||||
$Adapters = Get-NetAdapter | Where-Object {$_.Status -eq "Up"}
|
$Adapters = Get-NetAdapter | Where-Object {$_.Status -eq "Up"}
|
||||||
Write-Host "Ensuring DNS is set to $DNSProvider on the following interfaces"
|
Write-Host "Ensuring DNS is set to $DNSProvider on the following interfaces"
|
||||||
Write-Host $($Adapters | Out-String)
|
Write-Host $($Adapters | Out-String)
|
||||||
@ -21,14 +21,12 @@ function Set-WinUtilDNS {
|
|||||||
Foreach ($Adapter in $Adapters) {
|
Foreach ($Adapter in $Adapters) {
|
||||||
if($DNSProvider -eq "DHCP") {
|
if($DNSProvider -eq "DHCP") {
|
||||||
Set-DnsClientServerAddress -InterfaceIndex $Adapter.ifIndex -ResetServerAddresses
|
Set-DnsClientServerAddress -InterfaceIndex $Adapter.ifIndex -ResetServerAddresses
|
||||||
}
|
} else {
|
||||||
Else{
|
|
||||||
Set-DnsClientServerAddress -InterfaceIndex $Adapter.ifIndex -ServerAddresses ("$($sync.configs.dns.$DNSProvider.Primary)", "$($sync.configs.dns.$DNSProvider.Secondary)")
|
Set-DnsClientServerAddress -InterfaceIndex $Adapter.ifIndex -ServerAddresses ("$($sync.configs.dns.$DNSProvider.Primary)", "$($sync.configs.dns.$DNSProvider.Secondary)")
|
||||||
Set-DnsClientServerAddress -InterfaceIndex $Adapter.ifIndex -ServerAddresses ("$($sync.configs.dns.$DNSProvider.Primary6)", "$($sync.configs.dns.$DNSProvider.Secondary6)")
|
Set-DnsClientServerAddress -InterfaceIndex $Adapter.ifIndex -ServerAddresses ("$($sync.configs.dns.$DNSProvider.Primary6)", "$($sync.configs.dns.$DNSProvider.Secondary6)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set DNS Provider due to an unhandled exception"
|
Write-Warning "Unable to set DNS Provider due to an unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ function Set-WinUtilRegistry {
|
|||||||
$Value
|
$Value
|
||||||
)
|
)
|
||||||
|
|
||||||
Try{
|
try {
|
||||||
if(!(Test-Path 'HKU:\')) {New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS}
|
if(!(Test-Path 'HKU:\')) {New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS}
|
||||||
|
|
||||||
If (!(Test-Path $Path)) {
|
If (!(Test-Path $Path)) {
|
||||||
@ -37,14 +37,11 @@ function Set-WinUtilRegistry {
|
|||||||
|
|
||||||
Write-Host "Set $Path\$Name to $Value"
|
Write-Host "Set $Path\$Name to $Value"
|
||||||
Set-ItemProperty -Path $Path -Name $Name -Type $Type -Value $Value -Force -ErrorAction Stop | Out-Null
|
Set-ItemProperty -Path $Path -Name $Name -Type $Type -Value $Value -Force -ErrorAction Stop | Out-Null
|
||||||
}
|
} catch [System.Security.SecurityException] {
|
||||||
Catch [System.Security.SecurityException] {
|
|
||||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
}
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
Catch [System.Management.Automation.ItemNotFoundException] {
|
|
||||||
Write-Warning $psitem.Exception.ErrorRecord
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ function Set-WinUtilScheduledTask {
|
|||||||
$State
|
$State
|
||||||
)
|
)
|
||||||
|
|
||||||
Try{
|
try {
|
||||||
if($State -eq "Disabled") {
|
if($State -eq "Disabled") {
|
||||||
Write-Host "Disabling Scheduled Task $Name"
|
Write-Host "Disabling Scheduled Task $Name"
|
||||||
Disable-ScheduledTask -TaskName $Name -ErrorAction Stop
|
Disable-ScheduledTask -TaskName $Name -ErrorAction Stop
|
||||||
@ -28,17 +28,14 @@ function Set-WinUtilScheduledTask {
|
|||||||
Write-Host "Enabling Scheduled Task $Name"
|
Write-Host "Enabling Scheduled Task $Name"
|
||||||
Enable-ScheduledTask -TaskName $Name -ErrorAction Stop
|
Enable-ScheduledTask -TaskName $Name -ErrorAction Stop
|
||||||
}
|
}
|
||||||
}
|
} catch [System.Exception] {
|
||||||
Catch [System.Exception]{
|
|
||||||
if($psitem.Exception.Message -like "*The system cannot find the file specified*") {
|
if($psitem.Exception.Message -like "*The system cannot find the file specified*") {
|
||||||
Write-Warning "Scheduled Task $name was not Found"
|
Write-Warning "Scheduled Task $name was not Found"
|
||||||
}
|
} else {
|
||||||
Else{
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.Message
|
Write-Warning $psitem.Exception.Message
|
||||||
}
|
}
|
||||||
}
|
} catch {
|
||||||
Catch{
|
|
||||||
Write-Warning "Unable to run script for $name due to unhandled exception"
|
Write-Warning "Unable to run script for $name due to unhandled exception"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -26,11 +26,9 @@ Function Set-WinUtilService {
|
|||||||
|
|
||||||
# Service exists, proceed with changing properties
|
# Service exists, proceed with changing properties
|
||||||
$service | Set-Service -StartupType $StartupType -ErrorAction Stop
|
$service | Set-Service -StartupType $StartupType -ErrorAction Stop
|
||||||
}
|
} catch [System.ServiceProcess.ServiceNotFoundException] {
|
||||||
catch [System.ServiceProcess.ServiceNotFoundException] {
|
|
||||||
Write-Warning "Service $Name was not found"
|
Write-Warning "Service $Name was not found"
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
Write-Warning $_.Exception.Message
|
Write-Warning $_.Exception.Message
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,11 @@ function Set-WinUtilUITheme {
|
|||||||
# Replace the key with the value in the input XML
|
# Replace the key with the value in the input XML
|
||||||
$inputXML = $inputXML.Replace($formattedKey, $value)
|
$inputXML = $inputXML.Replace($formattedKey, $value)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "Theme '$themeName' not found."
|
Write-Host "Theme '$themeName' not found."
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Warning "Unable to apply theme"
|
Write-Warning "Unable to apply theme"
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,7 @@ function Test-WinUtilPackageManager {
|
|||||||
if (!$wingetOutdated) {
|
if (!$wingetOutdated) {
|
||||||
Write-Host " - Winget is Up to Date" -ForegroundColor Green
|
Write-Host " - Winget is Up to Date" -ForegroundColor Green
|
||||||
$status = "installed"
|
$status = "installed"
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host " - Winget is Out of Date" -ForegroundColor Red
|
Write-Host " - Winget is Out of Date" -ForegroundColor Red
|
||||||
$status = "outdated"
|
$status = "outdated"
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,7 @@ function Invoke-ScratchDialog {
|
|||||||
$filePath = $Dialog.SelectedPath
|
$filePath = $Dialog.SelectedPath
|
||||||
Write-Host "No ISO is chosen+ $filePath"
|
Write-Host "No ISO is chosen+ $filePath"
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($filePath))
|
if ([string]::IsNullOrEmpty($filePath)) {
|
||||||
{
|
|
||||||
Write-Host "No Folder had chosen"
|
Write-Host "No Folder had chosen"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -27,13 +27,11 @@ function Invoke-WPFGetIso {
|
|||||||
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg.exe) -or (Test-Path $oscdimgPath -PathType Leaf)
|
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg.exe) -or (Test-Path $oscdimgPath -PathType Leaf)
|
||||||
Write-Host "oscdimg.exe on system: $oscdImgFound"
|
Write-Host "oscdimg.exe on system: $oscdImgFound"
|
||||||
|
|
||||||
if (!$oscdImgFound)
|
if (!$oscdImgFound) {
|
||||||
{
|
|
||||||
$downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked
|
$downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked
|
||||||
$sync.BusyMessage.Visibility="Hidden"
|
$sync.BusyMessage.Visibility="Hidden"
|
||||||
|
|
||||||
if (!$downloadFromGitHub)
|
if (!$downloadFromGitHub) {
|
||||||
{
|
|
||||||
# only show the message to people who did check the box to download from github, if you check the box
|
# only show the message to people who did check the box to download from github, if you check the box
|
||||||
# you consent to downloading it, no need to show extra dialogs
|
# you consent to downloading it, no need to show extra dialogs
|
||||||
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it using choco. This might take a long time.")
|
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it using choco. This might take a long time.")
|
||||||
@ -42,8 +40,7 @@ function Invoke-WPFGetIso {
|
|||||||
Install-WinUtilChoco
|
Install-WinUtilChoco
|
||||||
$chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco)
|
$chocoFound = [bool] (Get-Command -ErrorAction Ignore -Type Application choco)
|
||||||
Write-Host "choco on system: $chocoFound"
|
Write-Host "choco on system: $chocoFound"
|
||||||
if (!$chocoFound)
|
if (!$chocoFound) {
|
||||||
{
|
|
||||||
[System.Windows.MessageBox]::Show("choco.exe is not found on the system, you need choco to download oscdimg.exe")
|
[System.Windows.MessageBox]::Show("choco.exe is not found on the system, you need choco to download oscdimg.exe")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -51,8 +48,7 @@ function Invoke-WPFGetIso {
|
|||||||
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install windows-adk-oscdimg"
|
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install windows-adk-oscdimg"
|
||||||
[System.Windows.MessageBox]::Show("oscdimg is installed, now close, reopen PowerShell terminal and re-launch winutil.ps1")
|
[System.Windows.MessageBox]::Show("oscdimg is installed, now close, reopen PowerShell terminal and re-launch winutil.ps1")
|
||||||
return
|
return
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it from github. This might take a long time.")
|
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it from github. This might take a long time.")
|
||||||
Get-Oscdimg -oscdimgPath $oscdimgPath
|
Get-Oscdimg -oscdimgPath $oscdimgPath
|
||||||
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
|
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
|
||||||
@ -60,8 +56,7 @@ function Invoke-WPFGetIso {
|
|||||||
$msg = "oscdimg was not downloaded can not proceed"
|
$msg = "oscdimg was not downloaded can not proceed"
|
||||||
[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)
|
||||||
return
|
return
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host "oscdimg.exe was successfully downloaded from github"
|
Write-Host "oscdimg.exe was successfully downloaded from github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,16 +69,14 @@ function Invoke-WPFGetIso {
|
|||||||
$openFileDialog.ShowDialog() | Out-Null
|
$openFileDialog.ShowDialog() | Out-Null
|
||||||
$filePath = $openFileDialog.FileName
|
$filePath = $openFileDialog.FileName
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($filePath))
|
if ([string]::IsNullOrEmpty($filePath)) {
|
||||||
{
|
|
||||||
Write-Host "No ISO is chosen"
|
Write-Host "No ISO is chosen"
|
||||||
$sync.BusyMessage.Visibility="Hidden"
|
$sync.BusyMessage.Visibility="Hidden"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "File path $($filePath)"
|
Write-Host "File path $($filePath)"
|
||||||
if (-not (Test-Path -Path $filePath -PathType Leaf))
|
if (-not (Test-Path -Path $filePath -PathType Leaf)) {
|
||||||
{
|
|
||||||
$msg = "File you've chosen doesn't exist"
|
$msg = "File you've chosen doesn't exist"
|
||||||
[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)
|
||||||
return
|
return
|
||||||
@ -98,20 +91,16 @@ function Invoke-WPFGetIso {
|
|||||||
# This is done to guarantee a dynamic solution, as the installation drive may be mounted to a letter different than C
|
# This is done to guarantee a dynamic solution, as the installation drive may be mounted to a letter different than C
|
||||||
$driveSpace = (Get-Volume -DriveLetter ([IO.Path]::GetPathRoot([Environment]::GetFolderPath([Environment+SpecialFolder]::UserProfile)).Replace(":\", "").Trim())).SizeRemaining
|
$driveSpace = (Get-Volume -DriveLetter ([IO.Path]::GetPathRoot([Environment]::GetFolderPath([Environment+SpecialFolder]::UserProfile)).Replace(":\", "").Trim())).SizeRemaining
|
||||||
Write-Debug "Free space on installation drive: $($driveSpace) bytes"
|
Write-Debug "Free space on installation drive: $($driveSpace) bytes"
|
||||||
if ($driveSpace -lt ($isoSize * 2))
|
if ($driveSpace -lt ($isoSize * 2)) {
|
||||||
{
|
|
||||||
# It's not critical and we _may_ continue. Output a warning
|
# It's not critical and we _may_ continue. Output a warning
|
||||||
Write-Warning "You may not have enough space for this operation. Proceed at your own risk."
|
Write-Warning "You may not have enough space for this operation. Proceed at your own risk."
|
||||||
}
|
}
|
||||||
elseif ($driveSpace -lt $isoSize)
|
elseif ($driveSpace -lt $isoSize) {
|
||||||
{
|
|
||||||
# It's critical and we can't continue. Output an error
|
# It's critical and we can't continue. Output an error
|
||||||
Write-Host "You don't have enough space for this operation. You need at least $([Math]::Round(($isoSize / ([Math]::Pow(1024, 2))) * 2, 2)) MB of free space to copy the ISO files to a temp directory and to be able to perform additional operations."
|
Write-Host "You don't have enough space for this operation. You need at least $([Math]::Round(($isoSize / ([Math]::Pow(1024, 2))) * 2, 2)) MB of free space to copy the ISO files to a temp directory and to be able to perform additional operations."
|
||||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||||
return
|
return
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
Write-Host "You have enough space for this operation."
|
Write-Host "You have enough space for this operation."
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,14 +140,12 @@ function Invoke-WPFGetIso {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Detect if the folders already exist and remove them
|
# Detect if the folders already exist and remove them
|
||||||
if (($sync.MicrowinMountDir.Text -ne "") -and (Test-Path -Path $sync.MicrowinMountDir.Text))
|
if (($sync.MicrowinMountDir.Text -ne "") -and (Test-Path -Path $sync.MicrowinMountDir.Text)) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
Write-Host "Deleting temporary files from previous run. Please wait..."
|
Write-Host "Deleting temporary files from previous run. Please wait..."
|
||||||
Remove-Item -Path $sync.MicrowinMountDir.Text -Recurse -Force
|
Remove-Item -Path $sync.MicrowinMountDir.Text -Recurse -Force
|
||||||
Remove-Item -Path $sync.MicrowinScratchDir.Text -Recurse -Force
|
Remove-Item -Path $sync.MicrowinScratchDir.Text -Recurse -Force
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Host "Could not delete temporary files. You need to delete those manually."
|
Write-Host "Could not delete temporary files. You need to delete those manually."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,16 +186,14 @@ 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)) -and (-not (Test-Path -Path $wimFile.Replace(".wim", ".esd").Trim() -PathType Leaf)))
|
if ((-not (Test-Path -Path $wimFile -PathType Leaf)) -and (-not (Test-Path -Path $wimFile.Replace(".wim", ".esd").Trim() -PathType Leaf))) {
|
||||||
{
|
|
||||||
$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/"
|
$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)
|
||||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||||
throw
|
throw
|
||||||
}
|
}
|
||||||
elseif ((-not (Test-Path -Path $wimFile -PathType Leaf)) -and (Test-Path -Path $wimFile.Replace(".wim", ".esd").Trim() -PathType Leaf))
|
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"
|
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()
|
$wimFile = $wimFile.Replace(".wim", ".esd").Trim()
|
||||||
}
|
}
|
||||||
@ -221,8 +206,7 @@ function Invoke-WPFGetIso {
|
|||||||
$sync.MicrowinWindowsFlavors.SelectedIndex = 0
|
$sync.MicrowinWindowsFlavors.SelectedIndex = 0
|
||||||
Write-Host "Finding suitable Pro edition. This can take some time. Do note that this is an automatic process that might not select the edition you want."
|
Write-Host "Finding suitable Pro edition. This can take some time. Do note that this is an automatic process that might not select the edition you want."
|
||||||
Get-WindowsImage -ImagePath $wimFile | ForEach-Object {
|
Get-WindowsImage -ImagePath $wimFile | ForEach-Object {
|
||||||
if ((Get-WindowsImage -ImagePath $wimFile -Index $_.ImageIndex).EditionId -eq "Professional")
|
if ((Get-WindowsImage -ImagePath $wimFile -Index $_.ImageIndex).EditionId -eq "Professional") {
|
||||||
{
|
|
||||||
# We have found the Pro edition
|
# We have found the Pro edition
|
||||||
$sync.MicrowinWindowsFlavors.SelectedIndex = $_.ImageIndex - 1
|
$sync.MicrowinWindowsFlavors.SelectedIndex = $_.ImageIndex - 1
|
||||||
}
|
}
|
||||||
@ -247,5 +231,3 @@ function Invoke-WPFGetIso {
|
|||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
Set-WinUtilTaskbaritem -state "None" -overlay "checkmark"
|
Set-WinUtilTaskbaritem -state "None" -overlay "checkmark"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,8 +33,7 @@ function Invoke-WPFImpex {
|
|||||||
|
|
||||||
if($FileBrowser.FileName -eq "") {
|
if($FileBrowser.FileName -eq "") {
|
||||||
return
|
return
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$Config = $FileBrowser.FileName
|
$Config = $FileBrowser.FileName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,8 +59,7 @@ function Invoke-WPFInstall {
|
|||||||
Write-Host "-- Installs have finished ---"
|
Write-Host "-- Installs have finished ---"
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
|
||||||
}
|
} catch {
|
||||||
Catch {
|
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
Write-Host "Error: $_"
|
Write-Host "Error: $_"
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
|
@ -63,18 +63,14 @@ public class PowerManagement {
|
|||||||
$scratchDir = $sync.MicrowinScratchDir.Text
|
$scratchDir = $sync.MicrowinScratchDir.Text
|
||||||
|
|
||||||
# Detect if the Windows image is an ESD file and convert it to WIM
|
# 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))
|
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..."
|
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"
|
Export-WindowsImage -SourceImagePath $mountDir\sources\install.esd -SourceIndex $index -DestinationImagePath $mountDir\sources\install.wim -CompressionType "Max"
|
||||||
if ($?)
|
if ($?) {
|
||||||
{
|
|
||||||
Remove-Item -Path $mountDir\sources\install.esd -Force
|
Remove-Item -Path $mountDir\sources\install.esd -Force
|
||||||
# Since we've already exported the image index we wanted, switch to the first one
|
# Since we've already exported the image index we wanted, switch to the first one
|
||||||
$index = 1
|
$index = 1
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$msg = "The export process has failed and MicroWin processing cannot continue"
|
$msg = "The export process has failed and MicroWin processing cannot continue"
|
||||||
Write-Host "Failed to export the image"
|
Write-Host "Failed to export the image"
|
||||||
[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)
|
||||||
@ -86,8 +82,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 ((Test-CompatibleImage $imgVersion $([System.Version]::new(10,0,10240,0))) -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."
|
||||||
Write-Host $msg
|
Write-Host $msg
|
||||||
@ -98,8 +93,7 @@ public class PowerManagement {
|
|||||||
|
|
||||||
$mountDirExists = Test-Path $mountDir
|
$mountDirExists = Test-Path $mountDir
|
||||||
$scratchDirExists = Test-Path $scratchDir
|
$scratchDirExists = Test-Path $scratchDir
|
||||||
if (-not $mountDirExists -or -not $scratchDirExists)
|
if (-not $mountDirExists -or -not $scratchDirExists) {
|
||||||
{
|
|
||||||
Write-Error "Required directories '$mountDirExists' '$scratchDirExists' and do not exist."
|
Write-Error "Required directories '$mountDirExists' '$scratchDirExists' and do not exist."
|
||||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||||
return
|
return
|
||||||
@ -109,68 +103,49 @@ public class PowerManagement {
|
|||||||
|
|
||||||
Write-Host "Mounting Windows image. This may take a while."
|
Write-Host "Mounting Windows image. This may take a while."
|
||||||
Mount-WindowsImage -ImagePath "$mountDir\sources\install.wim" -Index $index -Path "$scratchDir"
|
Mount-WindowsImage -ImagePath "$mountDir\sources\install.wim" -Index $index -Path "$scratchDir"
|
||||||
if ($?)
|
if ($?) {
|
||||||
{
|
|
||||||
Write-Host "Mounting complete! Performing removal of applications..."
|
Write-Host "Mounting complete! Performing removal of applications..."
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
Write-Host "Could not mount image. Exiting..."
|
Write-Host "Could not mount image. Exiting..."
|
||||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($importDrivers)
|
if ($importDrivers) {
|
||||||
{
|
|
||||||
Write-Host "Exporting drivers from active installation..."
|
Write-Host "Exporting drivers from active installation..."
|
||||||
if (Test-Path "$env:TEMP\DRV_EXPORT")
|
if (Test-Path "$env:TEMP\DRV_EXPORT") {
|
||||||
{
|
|
||||||
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
|
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
|
||||||
}
|
}
|
||||||
if (($injectDrivers -and (Test-Path $sync.MicrowinDriverLocation.Text)))
|
if (($injectDrivers -and (Test-Path $sync.MicrowinDriverLocation.Text))) {
|
||||||
{
|
|
||||||
Write-Host "Using specified driver source..."
|
Write-Host "Using specified driver source..."
|
||||||
dism /english /online /export-driver /destination="$($sync.MicrowinDriverLocation.Text)" | Out-Host
|
dism /english /online /export-driver /destination="$($sync.MicrowinDriverLocation.Text)" | Out-Host
|
||||||
if ($?)
|
if ($?) {
|
||||||
{
|
|
||||||
# Don't add exported drivers yet, that is run later
|
# Don't add exported drivers yet, that is run later
|
||||||
Write-Host "Drivers have been exported successfully."
|
Write-Host "Drivers have been exported successfully."
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
Write-Host "Failed to export drivers."
|
Write-Host "Failed to export drivers."
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
New-Item -Path "$env:TEMP\DRV_EXPORT" -ItemType Directory -Force
|
New-Item -Path "$env:TEMP\DRV_EXPORT" -ItemType Directory -Force
|
||||||
dism /english /online /export-driver /destination="$env:TEMP\DRV_EXPORT" | Out-Host
|
dism /english /online /export-driver /destination="$env:TEMP\DRV_EXPORT" | Out-Host
|
||||||
if ($?)
|
if ($?) {
|
||||||
{
|
|
||||||
Write-Host "Adding exported drivers..."
|
Write-Host "Adding exported drivers..."
|
||||||
dism /english /image="$scratchDir" /add-driver /driver="$env:TEMP\DRV_EXPORT" /recurse | Out-Host
|
dism /english /image="$scratchDir" /add-driver /driver="$env:TEMP\DRV_EXPORT" /recurse | Out-Host
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
Write-Host "Failed to export drivers. Continuing without importing them..."
|
Write-Host "Failed to export drivers. Continuing without importing them..."
|
||||||
}
|
}
|
||||||
if (Test-Path "$env:TEMP\DRV_EXPORT")
|
if (Test-Path "$env:TEMP\DRV_EXPORT") {
|
||||||
{
|
|
||||||
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
|
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($injectDrivers)
|
if ($injectDrivers) {
|
||||||
{
|
|
||||||
$driverPath = $sync.MicrowinDriverLocation.Text
|
$driverPath = $sync.MicrowinDriverLocation.Text
|
||||||
if (Test-Path $driverPath)
|
if (Test-Path $driverPath) {
|
||||||
{
|
|
||||||
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
|
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
|
||||||
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
|
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
Write-Host "Path to drivers is invalid continuing without driver injection"
|
Write-Host "Path to drivers is invalid continuing without driver injection"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,13 +154,11 @@ public class PowerManagement {
|
|||||||
Remove-Features -keepDefender:$keepDefender
|
Remove-Features -keepDefender:$keepDefender
|
||||||
Write-Host "Removing features complete!"
|
Write-Host "Removing features complete!"
|
||||||
|
|
||||||
if (!$keepPackages)
|
if (!$keepPackages) {
|
||||||
{
|
|
||||||
Write-Host "Removing OS packages"
|
Write-Host "Removing OS packages"
|
||||||
Remove-Packages
|
Remove-Packages
|
||||||
}
|
}
|
||||||
if (!$keepProvisionedPackages)
|
if (!$keepProvisionedPackages) {
|
||||||
{
|
|
||||||
Write-Host "Removing Appx Bloat"
|
Write-Host "Removing Appx Bloat"
|
||||||
Remove-ProvisionedPackages -keepSecurity:$keepDefender
|
Remove-ProvisionedPackages -keepSecurity:$keepDefender
|
||||||
}
|
}
|
||||||
@ -196,14 +169,12 @@ public class PowerManagement {
|
|||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\WebThreatDefSvc" -Directory
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\WebThreatDefSvc" -Directory
|
||||||
|
|
||||||
# Defender is hidden in 2 places we removed a feature above now need to remove it from the disk
|
# Defender is hidden in 2 places we removed a feature above now need to remove it from the disk
|
||||||
if (!$keepDefender)
|
if (!$keepDefender) {
|
||||||
{
|
|
||||||
Write-Host "Removing Defender"
|
Write-Host "Removing Defender"
|
||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Defender" -Directory
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Defender" -Directory
|
||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Defender"
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Defender"
|
||||||
}
|
}
|
||||||
if (!$keepEdge)
|
if (!$keepEdge) {
|
||||||
{
|
|
||||||
Write-Host "Removing Edge"
|
Write-Host "Removing Edge"
|
||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Microsoft" -mask "*edge*" -Directory
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Microsoft" -mask "*edge*" -Directory
|
||||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Microsoft" -mask "*edge*" -Directory
|
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Microsoft" -mask "*edge*" -Directory
|
||||||
@ -311,16 +282,14 @@ public class PowerManagement {
|
|||||||
reg add "HKLM\zSYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d 1 /f
|
reg add "HKLM\zSYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d 1 /f
|
||||||
reg add "HKLM\zSYSTEM\Setup\MoSetup" /v "AllowUpgradesWithUnsupportedTPMOrCPU" /t REG_DWORD /d 1 /f
|
reg add "HKLM\zSYSTEM\Setup\MoSetup" /v "AllowUpgradesWithUnsupportedTPMOrCPU" /t REG_DWORD /d 1 /f
|
||||||
|
|
||||||
if (!$keepEdge)
|
if (!$keepEdge) {
|
||||||
{
|
|
||||||
Write-Host "Removing Edge icon from taskbar"
|
Write-Host "Removing Edge icon from taskbar"
|
||||||
reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "Favorites" /f >$null 2>&1
|
reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "Favorites" /f >$null 2>&1
|
||||||
reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "FavoritesChanges" /f >$null 2>&1
|
reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "FavoritesChanges" /f >$null 2>&1
|
||||||
reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "Pinned" /f >$null 2>&1
|
reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "Pinned" /f >$null 2>&1
|
||||||
reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "LayoutCycle" /f >$null 2>&1
|
reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "LayoutCycle" /f >$null 2>&1
|
||||||
Write-Host "Edge icon removed from taskbar"
|
Write-Host "Edge icon removed from taskbar"
|
||||||
if (Test-Path "HKLM:\zSOFTWARE\WOW6432Node")
|
if (Test-Path "HKLM:\zSOFTWARE\WOW6432Node") {
|
||||||
{
|
|
||||||
# Remove leftovers of 64-bit installations
|
# Remove leftovers of 64-bit installations
|
||||||
# ---
|
# ---
|
||||||
# Remove registry values first...
|
# Remove registry values first...
|
||||||
@ -383,8 +352,7 @@ public class PowerManagement {
|
|||||||
Remove-Item "$mountDir\sources\install.wim"
|
Remove-Item "$mountDir\sources\install.wim"
|
||||||
Rename-Item "$mountDir\sources\install2.wim" "$mountDir\sources\install.wim"
|
Rename-Item "$mountDir\sources\install2.wim" "$mountDir\sources\install.wim"
|
||||||
|
|
||||||
if (-not (Test-Path -Path "$mountDir\sources\install.wim"))
|
if (-not (Test-Path -Path "$mountDir\sources\install.wim")) {
|
||||||
{
|
|
||||||
Write-Error "Something went wrong and '$mountDir\sources\install.wim' doesn't exist. Please report this bug to the devs"
|
Write-Error "Something went wrong and '$mountDir\sources\install.wim' doesn't exist. Please report this bug to the devs"
|
||||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||||
return
|
return
|
||||||
@ -395,16 +363,12 @@ public class PowerManagement {
|
|||||||
Write-Host "Mounting boot image $mountDir\sources\boot.wim into $scratchDir"
|
Write-Host "Mounting boot image $mountDir\sources\boot.wim into $scratchDir"
|
||||||
Mount-WindowsImage -ImagePath "$mountDir\sources\boot.wim" -Index 2 -Path "$scratchDir"
|
Mount-WindowsImage -ImagePath "$mountDir\sources\boot.wim" -Index 2 -Path "$scratchDir"
|
||||||
|
|
||||||
if ($injectDrivers)
|
if ($injectDrivers) {
|
||||||
{
|
|
||||||
$driverPath = $sync.MicrowinDriverLocation.Text
|
$driverPath = $sync.MicrowinDriverLocation.Text
|
||||||
if (Test-Path $driverPath)
|
if (Test-Path $driverPath) {
|
||||||
{
|
|
||||||
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
|
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
|
||||||
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
|
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
Write-Host "Path to drivers is invalid continuing without driver injection"
|
Write-Host "Path to drivers is invalid continuing without driver injection"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -447,8 +411,7 @@ public class PowerManagement {
|
|||||||
# if it is not in temp it is part of ADK and is in global PATH so just set it to oscdimg.exe
|
# if it is not in temp it is part of ADK and is in global PATH so just set it to oscdimg.exe
|
||||||
$oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
|
$oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
|
||||||
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
|
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
|
||||||
if (!$oscdImgFound)
|
if (!$oscdImgFound) {
|
||||||
{
|
|
||||||
$oscdimgPath = "oscdimg.exe"
|
$oscdimgPath = "oscdimg.exe"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,8 +428,7 @@ public class PowerManagement {
|
|||||||
$oscdimgProc.Start()
|
$oscdimgProc.Start()
|
||||||
$oscdimgProc.WaitForExit()
|
$oscdimgProc.WaitForExit()
|
||||||
|
|
||||||
if ($copyToUSB)
|
if ($copyToUSB) {
|
||||||
{
|
|
||||||
Write-Host "Copying target ISO to the USB drive"
|
Write-Host "Copying target ISO to the USB drive"
|
||||||
#Copy-ToUSB("$env:temp\microwin.iso")
|
#Copy-ToUSB("$env:temp\microwin.iso")
|
||||||
Copy-ToUSB("$($SaveDialog.FileName)")
|
Copy-ToUSB("$($SaveDialog.FileName)")
|
||||||
|
@ -10,8 +10,7 @@ function Invoke-WPFOOSU {
|
|||||||
Invoke-WebRequest -Uri "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -OutFile $OOSU_filepath
|
Invoke-WebRequest -Uri "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -OutFile $OOSU_filepath
|
||||||
Write-Host "Starting OO Shutup 10 ..."
|
Write-Host "Starting OO Shutup 10 ..."
|
||||||
Start-Process $OOSU_filepath
|
Start-Process $OOSU_filepath
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Host "Error Downloading and Running OO Shutup 10" -ForegroundColor Red
|
Write-Host "Error Downloading and Running OO Shutup 10" -ForegroundColor Red
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
@ -22,8 +22,7 @@ function Invoke-WPFPresets {
|
|||||||
|
|
||||||
if($imported -eq $true) {
|
if($imported -eq $true) {
|
||||||
$CheckBoxesToCheck = $preset
|
$CheckBoxesToCheck = $preset
|
||||||
}
|
} else {
|
||||||
Else{
|
|
||||||
$CheckBoxesToCheck = $sync.configs.preset.$preset
|
$CheckBoxesToCheck = $sync.configs.preset.$preset
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,8 +38,7 @@ function Invoke-WPFPresets {
|
|||||||
foreach ($CheckBox in $CheckBoxes) {
|
foreach ($CheckBox in $CheckBoxes) {
|
||||||
$checkboxName = $CheckBox.Key
|
$checkboxName = $CheckBox.Key
|
||||||
|
|
||||||
if (-not $CheckBoxesToCheck)
|
if (-not $CheckBoxesToCheck) {
|
||||||
{
|
|
||||||
$sync.$checkboxName.IsChecked = $false
|
$sync.$checkboxName.IsChecked = $false
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,7 @@ function Invoke-WPFRunspace {
|
|||||||
$script:handle = $script:powershell.BeginInvoke()
|
$script:handle = $script:powershell.BeginInvoke()
|
||||||
|
|
||||||
# Clean up the RunspacePool threads when they are complete, and invoke the garbage collector to clean up the memory
|
# Clean up the RunspacePool threads when they are complete, and invoke the garbage collector to clean up the memory
|
||||||
if ($script:handle.IsCompleted)
|
if ($script:handle.IsCompleted) {
|
||||||
{
|
|
||||||
$script:powershell.EndInvoke($script:handle)
|
$script:powershell.EndInvoke($script:handle)
|
||||||
$script:powershell.Dispose()
|
$script:powershell.Dispose()
|
||||||
$sync.runspace.Dispose()
|
$sync.runspace.Dispose()
|
||||||
|
@ -24,8 +24,7 @@ function Invoke-WPFShortcut {
|
|||||||
# Use Powershell 7 if installed and fallback to PS5 if not
|
# Use Powershell 7 if installed and fallback to PS5 if not
|
||||||
if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
|
if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
|
||||||
$shell = "pwsh.exe"
|
$shell = "pwsh.exe"
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$shell = "powershell.exe"
|
$shell = "powershell.exe"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,7 @@ function Invoke-WPFTab {
|
|||||||
$sync[$PSItem.Name].IsChecked = $false
|
$sync[$PSItem.Name].IsChecked = $false
|
||||||
# $tabNumber = [int]($PSItem.Name -replace "WPFTab","" -replace "BT","") - 1
|
# $tabNumber = [int]($PSItem.Name -replace "WPFTab","" -replace "BT","") - 1
|
||||||
# $sync.$tabNav.Items[$tabNumber].IsSelected = $false
|
# $sync.$tabNav.Items[$tabNumber].IsSelected = $false
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sync["$ClickedTab"].IsChecked = $true
|
$sync["$ClickedTab"].IsChecked = $true
|
||||||
$tabNumber = [int]($ClickedTab-replace "WPFTab","" -replace "BT","") - 1
|
$tabNumber = [int]($ClickedTab-replace "WPFTab","" -replace "BT","") - 1
|
||||||
$sync.$tabNav.Items[$tabNumber].IsSelected = $true
|
$sync.$tabNav.Items[$tabNumber].IsSelected = $true
|
||||||
|
@ -9,7 +9,7 @@ Function Invoke-WPFUltimatePerformance {
|
|||||||
|
|
||||||
#>
|
#>
|
||||||
param($State)
|
param($State)
|
||||||
Try{
|
try {
|
||||||
# Check if Ultimate Performance plan is installed
|
# Check if Ultimate Performance plan is installed
|
||||||
$ultimatePlan = powercfg -list | Select-String -Pattern "Ultimate Performance"
|
$ultimatePlan = powercfg -list | Select-String -Pattern "Ultimate Performance"
|
||||||
if($state -eq "Enable") {
|
if($state -eq "Enable") {
|
||||||
@ -47,7 +47,7 @@ Function Invoke-WPFUltimatePerformance {
|
|||||||
Write-Host "Ultimate Performance plan is not installed."
|
Write-Host "Ultimate Performance plan is not installed."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} Catch{
|
} catch {
|
||||||
Write-Warning $psitem.Exception.Message
|
Write-Warning $psitem.Exception.Message
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -68,8 +68,7 @@ function Invoke-WPFUnInstall {
|
|||||||
Write-Host "-- Uninstalls have finished ---"
|
Write-Host "-- Uninstalls have finished ---"
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
|
||||||
}
|
} catch {
|
||||||
Catch {
|
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
Write-Host "Error: $_"
|
Write-Host "Error: $_"
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
|
@ -55,12 +55,10 @@ $inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -repla
|
|||||||
if ((Get-WinUtilToggleStatus WPFToggleDarkMode) -eq $True) {
|
if ((Get-WinUtilToggleStatus WPFToggleDarkMode) -eq $True) {
|
||||||
if (Invoke-WinUtilGPU -eq $True) {
|
if (Invoke-WinUtilGPU -eq $True) {
|
||||||
$ctttheme = 'Matrix'
|
$ctttheme = 'Matrix'
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$ctttheme = 'Dark'
|
$ctttheme = 'Dark'
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$ctttheme = 'Classic'
|
$ctttheme = 'Classic'
|
||||||
}
|
}
|
||||||
$inputXML = Set-WinUtilUITheme -inputXML $inputXML -themeName $ctttheme
|
$inputXML = Set-WinUtilUITheme -inputXML $inputXML -themeName $ctttheme
|
||||||
@ -179,8 +177,7 @@ $commonKeyEvents = {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_.Key -eq "Escape")
|
if ($_.Key -eq "Escape") {
|
||||||
{
|
|
||||||
$sync.SearchBar.SelectAll()
|
$sync.SearchBar.SelectAll()
|
||||||
$sync.SearchBar.Text = ""
|
$sync.SearchBar.Text = ""
|
||||||
$sync.SearchBarClearButton.Visibility = "Collapsed"
|
$sync.SearchBarClearButton.Visibility = "Collapsed"
|
||||||
@ -188,8 +185,7 @@ $commonKeyEvents = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# don't ask, I know what I'm doing, just go...
|
# don't ask, I know what I'm doing, just go...
|
||||||
if (($_.Key -eq "Q" -and $_.KeyboardDevice.Modifiers -eq "Ctrl"))
|
if (($_.Key -eq "Q" -and $_.KeyboardDevice.Modifiers -eq "Ctrl")) {
|
||||||
{
|
|
||||||
$this.Close()
|
$this.Close()
|
||||||
}
|
}
|
||||||
if ($_.KeyboardDevice.Modifiers -eq "Alt") {
|
if ($_.KeyboardDevice.Modifiers -eq "Alt") {
|
||||||
@ -232,12 +228,9 @@ $sync["Form"].Add_MouseLeftButtonDown({
|
|||||||
})
|
})
|
||||||
|
|
||||||
$sync["Form"].Add_MouseDoubleClick({
|
$sync["Form"].Add_MouseDoubleClick({
|
||||||
if ($sync["Form"].WindowState -eq [Windows.WindowState]::Normal)
|
if ($sync["Form"].WindowState -eq [Windows.WindowState]::Normal) {
|
||||||
{
|
|
||||||
$sync["Form"].WindowState = [Windows.WindowState]::Maximized;
|
$sync["Form"].WindowState = [Windows.WindowState]::Maximized;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$sync["Form"].WindowState = [Windows.WindowState]::Normal;
|
$sync["Form"].WindowState = [Windows.WindowState]::Normal;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -377,8 +370,7 @@ $sync["SearchBar"].Add_TextChanged({
|
|||||||
|
|
||||||
if ($sync.SearchBar.Text -ne "") {
|
if ($sync.SearchBar.Text -ne "") {
|
||||||
$sync.SearchBarClearButton.Visibility = "Visible"
|
$sync.SearchBarClearButton.Visibility = "Visible"
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sync.SearchBarClearButton.Visibility = "Collapsed"
|
$sync.SearchBarClearButton.Visibility = "Collapsed"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,8 +396,7 @@ $sync["SearchBar"].Add_TextChanged({
|
|||||||
if ($textBlock -ne $null) {
|
if ($textBlock -ne $null) {
|
||||||
$textBlock.Visibility = "Visible"
|
$textBlock.Visibility = "Visible"
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$CheckBox.Value.Visibility = "Collapsed"
|
$CheckBox.Value.Visibility = "Collapsed"
|
||||||
# Set the corresponding text block visibility
|
# Set the corresponding text block visibility
|
||||||
if ($textBlock -ne $null) {
|
if ($textBlock -ne $null) {
|
||||||
@ -421,8 +412,7 @@ $sync["SearchBar"].Add_TextChanged({
|
|||||||
}
|
}
|
||||||
if ($activeCategories) {
|
if ($activeCategories) {
|
||||||
$inactiveCategories = Compare-Object -ReferenceObject $allCategories -DifferenceObject $activeCategories -PassThru
|
$inactiveCategories = Compare-Object -ReferenceObject $allCategories -DifferenceObject $activeCategories -PassThru
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$inactiveCategories = $allCategories
|
$inactiveCategories = $allCategories
|
||||||
}
|
}
|
||||||
foreach ($category in $inactiveCategories) {
|
foreach ($category in $inactiveCategories) {
|
||||||
@ -471,8 +461,7 @@ $sync["SettingsButton"].Add_Click({
|
|||||||
Write-Debug "SettingsButton clicked"
|
Write-Debug "SettingsButton clicked"
|
||||||
if ($sync["SettingsPopup"].IsOpen) {
|
if ($sync["SettingsPopup"].IsOpen) {
|
||||||
$sync["SettingsPopup"].IsOpen = $false
|
$sync["SettingsPopup"].IsOpen = $false
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sync["SettingsPopup"].IsOpen = $true
|
$sync["SettingsPopup"].IsOpen = $true
|
||||||
}
|
}
|
||||||
$_.Handled = $false
|
$_.Handled = $false
|
||||||
@ -528,8 +517,7 @@ $sync["SponsorMenuItem"].Add_Click({
|
|||||||
|
|
||||||
# Append the sponsors to the authorInfo
|
# Append the sponsors to the authorInfo
|
||||||
$sponsors | ForEach-Object { $authorInfo += "$_`n" }
|
$sponsors | ForEach-Object { $authorInfo += "$_`n" }
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
$authorInfo += "An error occurred while fetching or processing the sponsors: $_`n"
|
$authorInfo += "An error occurred while fetching or processing the sponsors: $_`n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +45,7 @@ $sync.configs = @{}
|
|||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
|
|
||||||
# If script isn't running as admin, show error message and quit
|
# If script isn't running as admin, show error message and quit
|
||||||
If (([Security.Principal.WindowsIdentity]::GetCurrent()).Owner.Value -ne "S-1-5-32-544")
|
If (([Security.Principal.WindowsIdentity]::GetCurrent()).Owner.Value -ne "S-1-5-32-544") {
|
||||||
{
|
|
||||||
Write-Host "===========================================" -Foregroundcolor Red
|
Write-Host "===========================================" -Foregroundcolor Red
|
||||||
Write-Host "-- Scripts must be run as Administrator ---" -Foregroundcolor Red
|
Write-Host "-- Scripts must be run as Administrator ---" -Foregroundcolor Red
|
||||||
Write-Host "-- Right-Click Start -> Terminal(Admin) ---" -Foregroundcolor Red
|
Write-Host "-- Right-Click Start -> Terminal(Admin) ---" -Foregroundcolor Red
|
||||||
|
Reference in New Issue
Block a user