Merge branch 'uninstall-ctt-powershell-profile' of https://github.com/Cryostrixx/winutil into uninstall-ctt-powershell-profile-fix

This commit is contained in:
Cryostrixx 2024-11-07 10:42:42 -08:00
commit 5064d82f74
No known key found for this signature in database
GPG Key ID: BB5F0D4A545DBB71
11 changed files with 184 additions and 141 deletions

View File

@ -91,7 +91,7 @@ $($jsonAsObject | ConvertTo-Json -Depth 3)
"@ "@
$sync.configs.$($psitem.BaseName) = $json | ConvertFrom-Json $sync.configs.$($psitem.BaseName) = $json | ConvertFrom-Json
$script_content.Add($(Write-Output "`$sync.configs.$($psitem.BaseName) = @'`n$json`n'@ `| ConvertFrom-Json" )) $script_content.Add($(Write-Output "`$sync.configs.$($psitem.BaseName) = @'`r`n$json`r`n'@ `| ConvertFrom-Json" ))
} }
# Read the entire XAML file as a single string, preserving line breaks # Read the entire XAML file as a single string, preserving line breaks
@ -125,10 +125,12 @@ Write-Progress -Activity "Compiling" -Completed
Update-Progress -Activity "Validating" -StatusMessage "Checking winutil.ps1 Syntax" -Percent 0 Update-Progress -Activity "Validating" -StatusMessage "Checking winutil.ps1 Syntax" -Percent 0
try { try {
$null = Get-Command -Syntax .\winutil.ps1 Get-Command -Syntax .\winutil.ps1 | Out-Null
} catch { } catch {
Write-Warning "Syntax Validation for 'winutil.ps1' has failed" Write-Warning "Syntax Validation for 'winutil.ps1' has failed"
Write-Host "$($Error[0])" -ForegroundColor Red Write-Host "$($Error[0])" -ForegroundColor Red
Pop-Location # Restore previous location before exiting...
exit 1
} }
Write-Progress -Activity "Validating" -Completed Write-Progress -Activity "Validating" -Completed

View File

@ -1892,7 +1892,7 @@
"choco": "sdio", "choco": "sdio",
"content": "Snappy Driver Installer Origin", "content": "Snappy Driver Installer Origin",
"description": "Snappy Driver Installer Origin is a free and open-source driver updater with a vast driver database for Windows.", "description": "Snappy Driver Installer Origin is a free and open-source driver updater with a vast driver database for Windows.",
"link": "https://sourceforge.net/projects/snappy-driver-installer-origin", "link": "https://www.glenn.delahoy.com/snappy-driver-installer-origin/",
"winget": "GlennDelahoy.SnappyDriverInstallerOrigin" "winget": "GlennDelahoy.SnappyDriverInstallerOrigin"
}, },
"session": { "session": {

View File

@ -1,18 +1,27 @@
### Launch Issues: ## Launch Issues
- Windows Security (formerly Defender) and other anti-virus software are known to block the script. The script gets flagged due to the fact that it requires administrator privileges & makes drastic system changes. ### Blocked by anti-virus
- If possible: Allow script in Anti-Virus software settings. Windows Security (formerly Defender) and other anti-virus software are known to block the script. The script gets flagged due to the fact that it requires administrator privileges & makes drastic system changes.
- If you are having TLS 1.2 issues, or are having trouble resolving `christitus.com/win` then run with the following command: To resolve this, allow/whitelist the script in your anti-virus software settings, or temporarily disable real-time protection. Since the project is open source, you may audit the code if security is a concern.
### Download not working
If `christitus.com/win` is not working, or you want to download the code from GitHub directly, you can use the direct download link:
```ps1 ```ps1
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12;iex(New-Object Net.WebClient).DownloadString('https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1') irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1 | iex
``` ```
- If you are unable to resolve `christitus.com/win` and are getting errors launching the tool, it might be due to India blocking GitHub's content domain and preventing downloads. If you are seeing errors referencing TLS or security, you may be running an older version of Windows where TLS 1.2 is not the default security protocol used for network connections. The following commands will force .NET to use TLS 1.2, and download the script directly using .NET instead of PowerShell:
- Source: <https://timesofindia.indiatimes.com/gadgets-news/github-content-domain-blocked-for-these-indian-users-reports/articleshow/96687992.cms>
If you are still having issues try using a **VPN**, or changing your **DNS provider** to one of following two providers: ```ps1
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
iex (New-Object Net.WebClient).DownloadString('https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1')
```
If it still isn't working and you live in India, it might be due to India blocking GitHub's content domain and preventing downloads. See more on [Times of India](https://timesofindia.indiatimes.com/gadgets-news/github-content-domain-blocked-for-these-indian-users-reports/articleshow/96687992.cms).
If you are still having issues, try using a **VPN**, or changing your **DNS provider** to one of following two providers:
| Provider | Primary DNS | Secondary DNS | | Provider | Primary DNS | Secondary DNS |
|:------------:|:------------:|:-------------:| |:------------:|:------------:|:-------------:|
@ -20,160 +29,186 @@ If you are still having issues try using a **VPN**, or changing your **DNS provi
| Google | `8.8.8.8` | `8.8.4.4` | | Google | `8.8.8.8` | `8.8.4.4` |
### Script blocked by Execution Policy
1. Ensure you are running PowerShell as admin: Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
2. In the PowerShell window, type this to allow unsigned code to execute and run the installation script:
```ps1
Set-ExecutionPolicy Unrestricted -Scope Process -Force
irm christitus.com/win | iex
```
- Script doesn't run/PowerShell crashes: ## Runtime Issues
1. Press Windows Key+X and select 'PowerShell (Admin)' (Windows 10) or 'Windows Terminal (Admin)' (Windows 11)
2. Run:
```ps1
Set-ExecutionPolicy Unrestricted -Scope Process -Force
```
3. Run:
```ps1
irm christitus.com/win | iex
```
### Other Issues: ### WinGet configuration
If you have not installed anything using PowerShell before, you may be prompted to configure WinGet. This requires user interaction on first run. You will need to manually type `y` into the PowerShell console and press enter to continue. Once you do it the first time, you will not be prompted again.
### MicroWin: Error `0x80041031`
This error code typically indicates an issue related to Windows Management Instrumentation (WMI). Here are a few steps you can try to resolve the issue:
1. **Reboot Your Computer:**
Sometimes, a simple reboot can resolve temporary issues. Restart your computer and try mounting the ISO again.
3. **Check for System Corruption:**
Run the System File Checker (SFC) utility to scan and repair system files that may be corrupted.
```powershell
sfc /scannow
```
4. **Update Your System:**
Make sure your operating system is up-to-date. Check for Windows updates and install any pending updates.
5. **Check WMI Service:**
Ensure that the Windows Management Instrumentation (WMI) service is running. You can do this through the Services application:
- Press `Win`+`R` to open the Run dialog.
- Type `services.msc` and press Enter.
- Locate *Windows Management Instrumentation* in the list.
- Make sure to set its status to "Running" and the startup type to "Automatic".
6. **Check for Security Software Interference:**
Security software can sometimes interfere with WMI operations. Temporarily disable your anti-virus or security software and check if the issue persists. WMI is a common attack/infection vector, so many anti-virus programs will limit its usage.
7. **Event Viewer:**
Check the Event Viewer for more detailed error information. Look for entries related to the `80041031` error and check if there are any additional details that can help identify the cause.
- Press `Win`+`X` and select *Event Viewer*.
- Navigate to *Windows Logs* > *Application* or *System*.
- Look for entries with the source related to WMI or the application use to mount the ISO.
8. **ISO File Integrity:**
Ensure that the ISO file you are trying to mount is uncorrupted. Try mounting a different ISO file to see if the issue persists.
If the problem persists after trying these steps, additional troubleshooting is required. Consider seeking assistance from Microsoft support or community forums for more specific guidance based on your system configuration and the software you use to mount the ISO.
## Windows Issues
### Windows takes longer to shut down
This could be for a number of reasons:
- Turn on fast startup: Press `Windows key`+`R`, then type:
```bat
control /name Microsoft.PowerOptions /page pageGlobalSettings
```
- If that doesn't work, disable Hibernation:
- Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
- In the PowerShell window, type:
```bat
powercfg /H off
```
Related issue: [#69](https://github.com/ChrisTitusTech/winutil/issues/69)
### Windows Search does not work
Enable Background Apps. Related issues: [#69](https://github.com/ChrisTitusTech/winutil/issues/69) [95](https://github.com/ChrisTitusTech/winutil/issues/95) [#232](https://github.com/ChrisTitusTech/winutil/issues/232)
### Xbox Game Bar Activation Broken
Set the Xbox Accessory Management Service to Automatic:
- Windows taking longer to shut down:
- [#69](https://github.com/ChrisTitusTech/winutil/issues/69) Turn on fast startup: Press Windows key + R, then type:
```
control /name Microsoft.PowerOptions /page pageGlobalSettings
```
- If that doesn't work, Disable Hibernation: Press Windows Key+X and select 'PowerShell (Admin)' (Windows 10) or 'Windows Terminal (Admin)' (Windows 11) and enter:
```ps1
powercfg /H off
```
- [#69](https://github.com/ChrisTitusTech/winutil/issues/69) [95](https://github.com/ChrisTitusTech/winutil/issues/95) [#232](https://github.com/ChrisTitusTech/winutil/issues/232) Windows Search does not work: Enable Background Apps
- [#198](https://github.com/ChrisTitusTech/winutil/issues/198) Xbox Game Bar Activation Broken: Set the Xbox Accessory Management Service to Automatic
```ps1 ```ps1
Get-Service -Name "XboxGipSvc" | Set-Service -StartupType Automatic Get-Service -Name "XboxGipSvc" | Set-Service -StartupType Automatic
``` ```
- Winget requires interaction on first run: Manually type 'y' and 'enter' into the PowerShell console to continue Related issue: [#198](https://github.com/ChrisTitusTech/winutil/issues/198)
- (Windows 11) Quick Settings no longer works: Launch the Script and click 'Enable Action Center'
- Explorer no longer launches: Go to Control Panel, File Explorer Options, Change the 'Open File Explorer to' option to 'This PC'. ### Windows 11: Quick Settings no longer works
Launch the Script and click *Enable Action Center*.
### Battery drains too fast. ### Explorer (file browser) no longer launches
* When your battery on the laptop drains too fast, please perform these steps and report the results back to the Winutil community. - Press `Windows key`+`R` then type:
```bat
control /name Microsoft.FolderOptions
```
- Change the *Open File Explorer to* option to *This PC*.
### Battery drains too fast
If you're using a laptop or tablet and find your battery drains too fast, please try the below troubleshooting steps, and report the results back to the Winutil community.
1. **Check Battery Health:** 1. **Check Battery Health:**
- Open a Command Prompt as an administrator. - Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
- Run the following command to generate a battery report: - Run the following command to generate a battery report:
```powershell ```powershell
powercfg /batteryreport /output "C:\battery_report.html" powercfg /batteryreport /output "C:\battery_report.html"
``` ```
- Open the generated HTML report to review information about battery health and usage. - Open the generated HTML report to review information about battery health and usage. A battery with poor health may hold less charge, discharge faster, or cause other issues.
2. **Review Power Settings:** 2. **Review Power Settings:**
- Go to "Settings" > "System" > "Power & sleep." - Open the Settings app, and go to *System* > *Power & sleep*.
- Adjust power plan settings based on your preferences and usage patterns. - Adjust power plan settings based on your preferences and usage patterns.
- Click on "Additional power settings" to access advanced power settings. - Click on *Additional power settings* to access advanced power settings that may help.
3. **Identify Power-Hungry Apps:** 3. **Identify Power-Hungry Apps:**
- Right-click on the taskbar and select "Task Manager." - Right-click on the taskbar and select *Task Manager*.
- Navigate to the "Processes" tab to identify applications with high CPU or memory usage. - Navigate to the *Processes* tab to identify applications with high CPU or memory usage.
- Consider closing unnecessary background applications. - Consider reconfiguring, closing, disabling, or uninstalling applications that use a lot of resources.
4. **Update Drivers:** 4. **Update Drivers:**
- Visit your laptop manufacturer's website or use Windows Update to check for driver updates. - Visit your device manufacturer's website or use Windows Update to check for driver updates.
- Ensure graphics, chipset, and other essential drivers are up to date. - Ensure graphics, chipset, and other essential drivers are up to date.
5. **Check for Windows Updates:** 5. **Check for Windows Updates:**
- Go to "Settings" > "Update & Security" > "Windows Update." - Open the Settings app, and go to *Update & Security* > *Windows Update*.
- Check for and install any available updates for your operating system. - Check for and install any available updates for your operating system.
6. **Reduce Screen Brightness:** 6. **Reduce Screen Brightness:**
- Adjust screen brightness based on your preferences and lighting conditions. - Open the Settings app, and go to *System* > *Display*.
- Go to "Settings" > "System" > "Display" to adjust brightness. - Adjust screen brightness based on your preferences and lighting conditions.
7. **Battery Saver Mode:** 7. **Enable Battery Saver:**
- Go to "Settings" > "System" > "Battery." - Open the Settings app, and go to *System* > *Battery*.
- Turn on "Battery saver" to limit background activity and conserve power. - Turn on *Battery saver* to limit background activity and conserve power.
8. **Check Power Usage in Settings:** 8. **Check Power Usage in Settings:**
- Go to "Settings" > "System" > "Battery" > "Battery usage by app." - Open the Settings app, and go to *System* > *Battery* > *Battery usage by app*.
- Review the list of apps and their power usage. - Review the list of apps and their power usage. Disable or uninstall any you don't need.
9. **Check Background Apps:** 9. **Check Background Apps:**
- Go to "Settings" > "Privacy" > "Background apps." - Open the Settings app, and go to *Privacy* > *Background apps*.
- Disable unnecessary apps running in the background. - Disable or uninstall unnecessary apps running in the background.
10. **Use Powercfg for Analysis:** 10. **Use `powercfg` for Analysis:**
- Open a Command Prompt as an administrator. - Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
- Run the following command to analyze energy usage and generate a report: - Run the following command to analyze energy usage and generate a report:
```powershell ```powershell
powercfg /energy /output "C:\energy_report.html" powercfg /energy /output "C:\energy_report.html"
``` ```
- Open the generated HTML report to identify energy consumption patterns. - Open the generated HTML report to identify energy consumption patterns.
11. **Review Event Viewer:** 11. **Review Event Logs:**
- Open Event Viewer by searching for it in the Start menu. - Open Event Viewer by searching for it in the Start menu.
- Navigate to "Windows Logs" > "System." - Navigate to *Windows Logs* > *System*.
- Look for events with the source "Power-Troubleshooter" to identify power-related events. - Look for events with the source *Power-Troubleshooter* to identify power-related events. These may highlight battery, input power, and other issues.
12. **Check Wake-up Sources:** 12. **Check Wake-up Sources:**
- Open a Command Prompt as an administrator. - Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
- Use the command `powercfg /requests` to identify processes preventing sleep. - Use the command `powercfg /requests` to identify processes preventing sleep.
- Check Task Scheduler for tasks waking up the computer.
- Use the command `powercfg /waketimers` to view active wake timers. - Use the command `powercfg /waketimers` to view active wake timers.
- Check Task Scheduler to see if any of the discovered processes are scheduled to start on boot or at regular intervals.
13. **Resource Monitor:** 13. **Advanced Identification of Power-Hungry Apps:**
- Open Resource Monitor from the Start menu. - Open Resource Monitor from the Start menu.
- Navigate to the "CPU" tab and identify processes with high CPU usage. - Navigate to the *CPU*, *Memory*, *Network*, and other tabs to identify processes with high resource usage.
- Consider reconfiguring, closing, disabling, or uninstalling applications that use a lot of resources.
14. **Windows Settings - Activity History:** 14. **Disable Activity History:**
- In "Settings," go to "Privacy" > "Activity history." - Open the Settings app, and go to *Privacy* > *Activity history*.
- Turn off "Let Windows collect my activities from this PC." - Turn off *Let Windows collect my activities from this PC*.
15. **Network Adapters:** 15. **Prevent Network Adapters From Waking PC:**
- Open Device Manager by searching for it in the Start menu. - Open Device Manager by searching for it in the Start menu.
- Locate your network adapter, right-click, and go to "Properties." - Locate your network adapter, right-click, and go to *Properties*.
- Under the "Power Management" tab, uncheck the option that allows the device to wake the computer. - Under the *Power Management* tab, uncheck the option that allows the device to wake the computer.
16. **Review Installed Applications:** 16. **Review Installed Applications:**
- Manually review installed applications by searching for "Add or remove programs" in the Start menu. - Manually review installed applications by searching for *Add or remove programs* in the Start menu.
- Check settings/preferences of individual applications for power-related options. - Check settings/preferences of individual applications for power-related options.
- Uninstall unnecessary or problematic software. - Uninstall unnecessary or problematic software.
* By following these detailed instructions, you should be able to thoroughly diagnose and address battery drain issues on your Windows laptop. Adjust settings as needed to optimize power management and improve battery life. These troubleshooting steps are generic, but should help in most situations. You should have these key takeaways:
- Battery health is the most significant limiter on your device's runtime. A battery in poor health usually cannot be made to last like it used to, simply by closing some applications. Consider replacing your battery.
### Troubleshoot errors during Microwin usage - Background applications that use CPU and memory, make lots of or large network requests, read/write to disk frequently, or that keep your PC awake when it could be conserving energy are the next major concern. Avoid installing programs you don't need, only use programs you trust, and configure applications to use as little power and run as infrequently as possible.
- Windows performs a lot of tasks that may affect battery life by default. Changing settings, stopping scheduled tasks, and disabling features can help the system stay in lower power states to conserve battery.
#### Error `0x80041031` - Bad chargers, inconsistent power input, and high temperatures will cause batteries to degrade and discharge faster. Use trusted high-quality chargers, ensure input power is steady, clean any fans or airflow ports, and keep the battery/PC cool.
* This error code typically indicates an issue related to Windows Management Instrumentation (WMI). Here are a few steps you can try to resolve the issue:
1. **Reboot Your Computer:**
Sometimes, a simple reboot can resolve temporary issues. Restart your computer and try mounting the ISO again.
2. **Check for System Corruption:**
Run the System File Checker (SFC) utility to scan and repair system files that may be corrupted.
```powershell
sfc /scannow
```
3. **Update Your System:**
Make sure your operating system is up-to-date. Check for Windows updates and install any pending updates.
4. **Check WMI Service:**
Ensure that the Windows Management Instrumentation (WMI) service is running. You can do this through the Services application:
- Press `Win + R` to open the Run dialog.
- Type `services.msc` and press Enter.
- Locate "Windows Management Instrumentation" in the list.
- Make sure to set its status to "Running" and the startup type to "Automatic."
5. **Check for Security Software Interference:**
Security software can sometimes interfere with WMI operations. Temporarily disable your antivirus or security software and check if the issue persists.
6. **Event Viewer:**
Check the Event Viewer for more detailed error information. Look for entries related to the `80041031` error and check if there are any additional details that can help identify the cause.
- Press `Win + X` and select "Event Viewer."
- Navigate to "Windows Logs" -> "Application" or "System."
- Look for entries with the source related to WMI or the application use to mount the ISO.
7. **ISO File Integrity:**
Ensure that the ISO file you are trying to mount is uncorrupted. Try mounting a different ISO file to see if the issue persists.
* If the problem persists after trying these steps, additional troubleshooting is required. Consider seeking assistance from Microsoft support or community forums for more specific guidance based on your system configuration and the software you use to mount the ISO.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 KiB

After

Width:  |  Height:  |  Size: 122 KiB

View File

@ -77,13 +77,17 @@ The utility provides a convenient DNS selection feature, allowing users to choos
* **Default**: Uses the default DNS settings configured by your ISP or network. * **Default**: Uses the default DNS settings configured by your ISP or network.
* **DHCP**: Automatically acquires DNS settings from the DHCP server. * **DHCP**: Automatically acquires DNS settings from the DHCP server.
* [**Google**](https://developers.google.com/speed/public-dns?hl=de): A reliable and fast DNS service provided by Google. * [**Google**](https://developers.google.com/speed/public-dns?hl=en): A reliable and fast DNS service provided by Google.
* [**Cloudflare**](https://developers.cloudflare.com/1.1.1.1/): Known for speed and privacy, Cloudflare DNS is a popular choice for enhancing internet performance. * [**Cloudflare**](https://developers.cloudflare.com/1.1.1.1/): Known for speed and privacy, Cloudflare DNS is a popular choice for enhancing internet performance.
* [**Cloudflare_Malware**](https://developers.cloudflare.com/1.1.1.1/setup/#:~:text=Use%20the%20following%20DNS%20resolvers%20to%20block%20malicious%20content%3A): Provides additional protection by blocking malware sites. * [**Cloudflare_Malware**](https://developers.cloudflare.com/1.1.1.1/setup/#:~:text=Use%20the%20following%20DNS%20resolvers%20to%20block%20malicious%20content%3A): Provides additional protection by blocking malware sites.
* [**Cloudflare_Malware_Adult**](https://developers.cloudflare.com/1.1.1.1/setup/#:~:text=Use%20the%20following%20DNS%20resolvers%20to%20block%20malware%20and%20adult%20content%3A): Blocks both malware and adult content, offering more comprehensive filtering. * [**Cloudflare_Malware_Adult**](https://developers.cloudflare.com/1.1.1.1/setup/#:~:text=Use%20the%20following%20DNS%20resolvers%20to%20block%20malware%20and%20adult%20content%3A): Blocks both malware and adult content, offering more comprehensive filtering.
* [**Level3**](https://www.lumen.com/): Another fast and reliable DNS service option.
* [**Open_DNS**](https://www.opendns.com/setupguide/#familyshield): Offers customizable filtering and enhanced security features. * [**Open_DNS**](https://www.opendns.com/setupguide/#familyshield): Offers customizable filtering and enhanced security features.
* [**Quad9**](https://quad9.net/): Focuses on security by blocking known malicious domains. * [**Quad9**](https://quad9.net/): Focuses on security by blocking known malicious domains.
* [**AdGuard_Ads_Trackers**](https://adguard-dns.io/en/welcome.html) AdGuard DNS will block ads, trackers, or any other DNS requests. Visit website and login for a dashboard, statistics and customize your experience in the server settings.
* [**AdGuard_Ads_Trackers_Malware_Adult**](https://adguard-dns.io/en/welcome.html) AdGuard DNS will block ads, trackers, adult content, and enable Safe Search and Safe Mode, where possible.
* [**dns0.eu_Open**](https://www.dns0.eu/) The European public DNS that makes your Internet safer. Offers general-purpose filtering to block malware, phishing, and tracking domains for enhanced privacy and security.
* [**dns0.eu_ZERO**](https://www.dns0.eu/zero) Provides advanced security with robust filters for highly sensitive environments, blocking high-risk domains using threat intelligence and sophisticated heuristics like Newly Registered Domains (NRD) and Domain Generation Algorithms (DGA).
* [**dns0.eu_KIDS**](https://www.dns0.eu/kids) A child-safe DNS that blocks adult content, explicit search results, mature videos, dating sites, piracy, and ads, creating a secure internet experience for children on any device or network.
### Customize Preferences ### Customize Preferences

View File

@ -76,6 +76,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
Write-Host "The Windows Image Build Version is: $imgVersion"
# 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 ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,10240,0))) -eq $false) { if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,10240,0))) -eq $false) {
@ -163,7 +164,7 @@ public class PowerManagement {
Microwin-RemoveProvisionedPackages Microwin-RemoveProvisionedPackages
# Detect Windows 11 24H2 and add dependency to FileExp to prevent Explorer look from going back - thanks @WitherOrNot and @thecatontheceiling # Detect Windows 11 24H2 and add dependency to FileExp to prevent Explorer look from going back - thanks @WitherOrNot and @thecatontheceiling
if ((Test-CompatibleImage $imgVersion $([System.Version]::new(10,0,26100,1))) -eq $true) { if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,26100,1))) -eq $true) {
try { try {
if (Test-Path "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" -PathType Leaf) { if (Test-Path "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" -PathType Leaf) {
# Found the culprit. Do the following: # Found the culprit. Do the following:

View File

@ -18,4 +18,4 @@ function Microwin-GetLocalizedUsers
} else { } else {
return (Get-LocalGroup | Where-Object { $_.SID.Value -like "S-1-5-32-545" }).Name return (Get-LocalGroup | Where-Object { $_.SID.Value -like "S-1-5-32-545" }).Name
} }
} }

View File

@ -44,7 +44,7 @@ function Install-WinUtilProgramChoco {
New-Item -ItemType File -Path $filePath | Out-Null New-Item -ItemType File -Path $filePath | Out-Null
} }
function Run-ChocoCommand { function Invoke-ChocoCommand {
<# <#
.SYNOPSIS .SYNOPSIS
Executes a Chocolatey command with the specified arguments and returns the exit code. Executes a Chocolatey command with the specified arguments and returns the exit code.
@ -60,14 +60,14 @@ function Install-WinUtilProgramChoco {
The exit code of the Chocolatey command. The exit code of the Chocolatey command.
.EXAMPLE .EXAMPLE
$exitCode = Run-ChocoCommand -arguments "install 7zip -y" $exitCode = Invoke-ChocoCommand -arguments "install 7zip -y"
#> #>
param ($arguments) param ($arguments)
return (Start-Process -FilePath "choco" -ArgumentList $arguments -Wait -PassThru).ExitCode return (Start-Process -FilePath "choco" -ArgumentList $arguments -Wait -PassThru).ExitCode
} }
function Check-UpgradeNeeded { function Test-UpgradeNeeded {
<# <#
.SYNOPSIS .SYNOPSIS
Checks if an upgrade is needed for a Chocolatey package based on the content of a log file. Checks if an upgrade is needed for a Chocolatey package based on the content of a log file.
@ -83,7 +83,7 @@ function Install-WinUtilProgramChoco {
True if the log file indicates that an upgrade is needed; otherwise, false. True if the log file indicates that an upgrade is needed; otherwise, false.
.EXAMPLE .EXAMPLE
$isUpgradeNeeded = Check-UpgradeNeeded -filePath "C:\temp\install-output.txt" $isUpgradeNeeded = Test-UpgradeNeeded -filePath "C:\temp\install-output.txt"
#> #>
param ($filePath) param ($filePath)
@ -149,11 +149,11 @@ function Install-WinUtilProgramChoco {
Write-Host "Starting installation of $Program with Chocolatey." Write-Host "Starting installation of $Program with Chocolatey."
try { try {
$installStatusCode = Run-ChocoCommand "install $Program -y --log-file $installOutputFile" $installStatusCode = Invoke-ChocoCommand "install $Program -y --log-file $installOutputFile"
if ($installStatusCode -eq 0) { if ($installStatusCode -eq 0) {
if (Check-UpgradeNeeded $installOutputFile) { if (Test-UpgradeNeeded $installOutputFile) {
$upgradeStatusCode = Run-ChocoCommand "upgrade $Program -y" $upgradeStatusCode = Invoke-ChocoCommand "upgrade $Program -y"
Write-Host "$Program was" $(if ($upgradeStatusCode -eq 0) { "upgraded successfully." } else { "not upgraded." }) Write-Host "$Program was" $(if ($upgradeStatusCode -eq 0) { "upgraded successfully." } else { "not upgraded." })
} }
else { else {
@ -207,7 +207,7 @@ function Install-WinUtilProgramChoco {
if ($chocoPackages) { if ($chocoPackages) {
Write-Host "Starting uninstallation of $chocoPackages with Chocolatey." Write-Host "Starting uninstallation of $chocoPackages with Chocolatey."
try { try {
$uninstallStatusCode = Run-ChocoCommand "uninstall $chocoPackages -y" $uninstallStatusCode = Invoke-ChocoCommand "uninstall $chocoPackages -y"
Write-Host "$Program" $(if ($uninstallStatusCode -eq 0) { "uninstalled successfully." } else { "failed to uninstall." }) Write-Host "$Program" $(if ($uninstallStatusCode -eq 0) { "uninstalled successfully." } else { "failed to uninstall." })
} }
catch { catch {

View File

@ -100,4 +100,4 @@ function Invoke-WinUtilInstallPSProfile {
Write-Host "This profile requires Powershell Core, which is currently not installed!" -ForegroundColor Red Write-Host "This profile requires Powershell Core, which is currently not installed!" -ForegroundColor Red
} }
} }
} }

View File

@ -184,4 +184,4 @@ function Invoke-WinUtilUninstallPSProfile {
Write-Host "===> No PowerShell Profile Found. Skipped Uninstallation. <===" -ForegroundColor Magenta Write-Host "===> No PowerShell Profile Found. Skipped Uninstallation. <===" -ForegroundColor Magenta
} }
} }
} }

View File

@ -10,17 +10,18 @@ function Invoke-WPFTab {
#> #>
Param ($ClickedTab) Param (
[Parameter(Mandatory,position=0)]
[string]$ClickedTab
)
$tabNav = Get-WinUtilVariables | Where-Object {$psitem -like "WPFTabNav"} $tabNav = Get-WinUtilVariables | Where-Object {$psitem -like "WPFTabNav"}
$tabNumber = [int]($ClickedTab -replace "WPFTab","" -replace "BT","") - 1 $tabNumber = [int]($ClickedTab -replace "WPFTab","" -replace "BT","") - 1
$filter = Get-WinUtilVariables -Type ToggleButton | Where-Object {$psitem -like "WPFTab?BT"} $filter = Get-WinUtilVariables -Type ToggleButton | Where-Object {$psitem -like "WPFTab?BT"}
$sync.GetEnumerator() | Where-Object {$psitem.Key -in $filter} | ForEach-Object { ($sync.GetEnumerator()).where{$psitem.Key -in $filter} | ForEach-Object {
if ($ClickedTab -ne $PSItem.name) { if ($ClickedTab -ne $PSItem.name) {
$sync[$PSItem.Name].IsChecked = $false $sync[$PSItem.Name].IsChecked = $false
# $tabNumber = [int]($PSItem.Name -replace "WPFTab","" -replace "BT","") - 1
# $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