mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 14:45:52 -06:00
Merge branch 'ChrisTitusTech:main' into appspanelrestyle
This commit is contained in:
commit
5bbc6c6a92
117
.github/CONTRIBUTING.md
vendored
117
.github/CONTRIBUTING.md
vendored
@ -1,117 +0,0 @@
|
||||
# How to Contribute?
|
||||
|
||||
## Testing
|
||||
|
||||
* Test the latest changes to WinUtil by running the pre-release and reporting issues you are encountering to help us continually improve WinUtil!
|
||||
|
||||
#### **Run the latest pre-release**
|
||||
```ps1
|
||||
irm christitus.com/windev | iex
|
||||
```
|
||||
|
||||
!!! bug "Keep in mind"
|
||||
|
||||
This is a pre-release and should be treated as such. It exists for developers to test the utility and report or fix bugs before they get added to the stable release. Don't use it in production!
|
||||
|
||||
## Issues
|
||||
|
||||
* If you encounter any challenges or problems with the script, I kindly request that you submit them via the "Issues" tab on the GitHub repository. By filling out the provided template, you can provide specific details about the issue, allowing me (and others in the community) to promptly address any bugs or consider feature requests.
|
||||
|
||||
## Contribute Code
|
||||
|
||||
* Pull requests are now handled directly on the **MAIN branch**. This was done since we can now select specific releases to launch via releases in GitHub.
|
||||
|
||||
* If you're doing code changes, then you can submit a PR to `main` branch, but I am very selective about these.
|
||||
|
||||
!!! warning "Important"
|
||||
|
||||
Do not use a code formatter, make massive amounts of line changes, or make multiple feature changes. EACH FEATURE CHANGE SHOULD BE IT'S OWN PULL REQUEST!
|
||||
|
||||
* When creating pull requests, it is essential to thoroughly document all changes made. This includes, but is not limited to, documenting any additions made to the `tweaks` section and corresponding `undo tweak`, so users are able to remove the newly added tweaks if necessary, and comprehensive documentation is required for all code changes. Document your changes and briefly explain why you made your changes in your Pull Request Description. Failure to adhere to this format may result in the denial of the pull request. Additionally, any code lacking sufficient documentation may also be denied.
|
||||
|
||||
* By following these guidelines, we can maintain a high standard of quality and ensure that the codebase remains organized and well-documented.
|
||||
|
||||
!!! note
|
||||
|
||||
When creating a function, please include "WPF" or "WinUtil" in the file name so it can be loaded into the runspace.
|
||||
|
||||
## Walk through
|
||||
|
||||
* This is a guide for beginners. If you are still having issues, look at the following official GitHub documentation:
|
||||
* [Commit through WEB](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/about-commits)
|
||||
* [Commit through GitHub Desktop](https://docs.github.com/en/desktop/making-changes-in-a-branch/committing-and-reviewing-changes-to-your-project-in-github-desktop#about-commits)
|
||||
* [Create a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)
|
||||
|
||||
|
||||
### Overview
|
||||
|
||||
``` mermaid
|
||||
%%{init: {"flowchart": {"curve": "cardinal"}} }%%
|
||||
graph TD
|
||||
A[Fork Project] --> B[Clone Repository];
|
||||
B --> C[Create New Branch];
|
||||
C --> D[Make Changes];
|
||||
D --> G[Test Changes];
|
||||
G --> H{Tests Passed?};
|
||||
H -->|Yes| E[Commit Changes];
|
||||
H -->|No| J[Fix Issues];
|
||||
J --> G;
|
||||
E --> F[Push Branch];
|
||||
F --> K[Create Pull Request];
|
||||
K --> L[Fill out PR template];
|
||||
classDef default stroke:#333,stroke-width:4px,font-size:12pt;
|
||||
```
|
||||
!!! info
|
||||
|
||||
This is a diagram to guide you through the process. It may vary depending on the type of change you're making.
|
||||
|
||||
### Fork the Repo
|
||||
* Fork the WinUtil Repository [here](https://github.com/ChrisTitusTech/winutil) to create a copy that will be available in your repository list.
|
||||
|
||||
![Fork Image](assets/Fork-Button-Dark.png#only-dark)
|
||||
|
||||
![Fork Image](assets/Fork-Button-Light.png#only-light)
|
||||
|
||||
### Clone the Fork
|
||||
!!! tip
|
||||
|
||||
While you can make your changes directly through the Web, we recommend cloning the repo to your device using the application GitHub Desktop (available in WinUtil) to test your fork easily.
|
||||
|
||||
* Install GitHub Desktop if it is not already installed.
|
||||
* Log in using the same GitHub account you used to fork WinUtil.
|
||||
* Choose the fork under "Your Repositories" and press "clone {repo name}"
|
||||
* Create a new branch and name it something relatable to your changes.
|
||||
|
||||
* Now you can modify WinUtil to your liking using your preferred text editor.
|
||||
|
||||
|
||||
### Testing your changes
|
||||
|
||||
* To test to see if your changes work as intended run following commands in a powershell teminal as admin:
|
||||
|
||||
* Change the directory where you are running the commands to the forked project.
|
||||
* `cd {path to the folder with the compile.ps1}`
|
||||
* Run the following command to compile and run WinUtil:
|
||||
* `.\Compile.ps1 -run`
|
||||
|
||||
![Compile](assets/Compile.png)
|
||||
|
||||
* After seeing that your changes work properly, feel free to commit the changes to the repository and make a PR. For help on that, follow the documentation below.
|
||||
|
||||
### Committing the changes
|
||||
* Before committing your changes, please discard changes made to the `winutil.ps1` file, like the following:
|
||||
|
||||
![Push Commit Image](assets/Discard-GHD.png)
|
||||
|
||||
* Now, commit your changes once you are happy with the result.
|
||||
|
||||
![Commit Image](assets/Commit-GHD.png)
|
||||
|
||||
* Push the changes to upload them to your fork on github.com.
|
||||
|
||||
![Push Commit Image](assets/Push-Commit.png)
|
||||
|
||||
### Making a PR
|
||||
* To make a PR on your repo under a new branch linking to the main branch, a button will show and say Preview and Create pull request. Click that button and fill in all the information that is provided on the template. Once all the information is filled in correctly, check your PR to make sure there is not a WinUtil.ps1 file attached to the PR. Once everything is good, make the PR and wait for Chris (the maintainer) to accept or deny your PR. Once it is accepted by Chris, you will be able to see your changes in the "/windev" build.
|
||||
* If you do not see your feature in the main "/win" build, that is fine. All new changes go into the /windev build to make sure everything is working OK before going fully public.
|
||||
* Congratulations! You just submitted your first PR. Thank you so much for contributing to WinUtil.
|
3
.github/mkdocs.yml
vendored
3
.github/mkdocs.yml
vendored
@ -11,6 +11,9 @@ nav:
|
||||
- Known Issues: 'KnownIssues.md'
|
||||
- FAQ: 'faq.md'
|
||||
|
||||
not_in_nav: |
|
||||
dev/
|
||||
|
||||
theme:
|
||||
name: material
|
||||
custom_dir: '../overrides'
|
||||
|
15
Compile.ps1
15
Compile.ps1
@ -73,8 +73,8 @@ Get-ChildItem "functions" -Recurse -File | ForEach-Object {
|
||||
}
|
||||
Update-Progress "Adding: Config *.json" 40
|
||||
Get-ChildItem "config" | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object {
|
||||
$json = (Get-Content $psitem.FullName).replace("'","''")
|
||||
$jsonAsObject = $json | convertfrom-json
|
||||
$json = (Get-Content $psitem.FullName -Raw)
|
||||
$jsonAsObject = $json | ConvertFrom-Json
|
||||
|
||||
# Add 'WPFInstall' as a prefix to every entry-name in 'applications.json' file
|
||||
if ($psitem.Name -eq "applications.json") {
|
||||
@ -85,12 +85,13 @@ Get-ChildItem "config" | Where-Object {$psitem.extension -eq ".json"} | ForEach-
|
||||
}
|
||||
}
|
||||
|
||||
# The replace at the end is required, as without it the output of 'converto-json' will be somewhat weird for Multiline Strings
|
||||
# Most Notably is the scripts in some json files, making it harder for users who want to review these scripts, which're found in the compiled script
|
||||
$json = ($jsonAsObject | convertto-json -Depth 3).replace('\r\n',"`r`n")
|
||||
# Line 90 requires no whitespace inside the here-strings, to keep formatting of the JSON in the final script.
|
||||
$json = @"
|
||||
$($jsonAsObject | ConvertTo-Json -Depth 3)
|
||||
"@
|
||||
|
||||
$sync.configs.$($psitem.BaseName) = $json | convertfrom-json
|
||||
$script_content.Add($(Write-output "`$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" ))
|
||||
}
|
||||
|
||||
# Read the entire XAML file as a single string, preserving line breaks
|
||||
|
@ -445,7 +445,7 @@
|
||||
"category": "Utilities",
|
||||
"content": "Dual Monitor Tools",
|
||||
"link": "https://dualmonitortool.sourceforge.net/",
|
||||
"description": "Dual Monitor Tools (DMT) is a FOSS app that customize handling multiple monitors and even lock the mouse on specific monitor. Useful for full screen games and apps that does not handle well a second monitor or helps the workflow."
|
||||
"description": "Dual Monitor Tools (DMT) is a FOSS app that allows you to customize the handling of multiple monitors. Useful for fullscreen games and apps that handle a second monitor poorly and can improve your workflow."
|
||||
},
|
||||
"duplicati": {
|
||||
"category": "Utilities",
|
||||
@ -2855,14 +2855,6 @@
|
||||
"link": "https://www.kicad.org/",
|
||||
"winget": "KiCad.KiCad"
|
||||
},
|
||||
"FormatFactory": {
|
||||
"category": "Utilities",
|
||||
"choco": "formatfactory",
|
||||
"content": "Format Factory",
|
||||
"description":"FormatFactory is an ad-supported freeware multimedia converter that can convert video, audio, and picture files. It is also capable of ripping DVDs and CDs to other file formats, as well as creating .iso images. It can also join multiple video files together into one.",
|
||||
"link": "http://www.pcfreetime.com/formatfactory/",
|
||||
"winget": "na"
|
||||
},
|
||||
"dropox": {
|
||||
"category": "Utilities",
|
||||
"choco": "na",
|
||||
|
@ -46,5 +46,23 @@
|
||||
"Secondary": "94.140.15.16",
|
||||
"Primary6": "2a10:50c0::bad1:ff",
|
||||
"Secondary6": "2a10:50c0::bad2:ff"
|
||||
},
|
||||
"dns0.eu_Open":{
|
||||
"Primary": "193.110.81.254",
|
||||
"Secondary": "185.253.5.254",
|
||||
"Primary6": "2a0f:fc80::ffff",
|
||||
"Secondary6": "2a0f:fc81::ffff"
|
||||
},
|
||||
"dns0.eu_ZERO":{
|
||||
"Primary": "193.110.81.9",
|
||||
"Secondary": "185.253.5.9",
|
||||
"Primary6": "2a0f:fc80::9",
|
||||
"Secondary6": "2a0f:fc81::9"
|
||||
},
|
||||
"dns0.eu_KIDS":{
|
||||
"Primary": "193.110.81.1",
|
||||
"Secondary": "185.253.5.1",
|
||||
"Primary6": "2a0f:fc80::1",
|
||||
"Secondary6": "2a0f:fc81::1"
|
||||
}
|
||||
}
|
||||
|
@ -313,5 +313,13 @@
|
||||
"Order": "a083_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300"
|
||||
},
|
||||
"WPFWinUtilSSHServer": {
|
||||
"Content": "Enable OpenSSH Server",
|
||||
"category": "Remote Access",
|
||||
"panel": "2",
|
||||
"Order": "a084_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300"
|
||||
}
|
||||
}
|
||||
|
@ -1600,13 +1600,6 @@
|
||||
"Value": "0",
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "EdgeEnhanceImagesEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "PersonalizationReportingEnabled",
|
||||
@ -1656,13 +1649,6 @@
|
||||
"Value": "0",
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "EdgeFollowEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "EdgeShoppingAssistantEnabled",
|
||||
@ -1726,13 +1712,6 @@
|
||||
"Value": "0",
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "ConfigureDoNotTrack",
|
||||
"Type": "DWord",
|
||||
"Value": "1",
|
||||
"OriginalValue": "0"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "WalletDonationEnabled",
|
||||
@ -2430,12 +2409,6 @@
|
||||
"Order": "a001_",
|
||||
"InvokeScript": [
|
||||
"
|
||||
# Check if the user has administrative privileges
|
||||
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
Write-Host \"Please run this script as an administrator.\"
|
||||
return
|
||||
}
|
||||
|
||||
# Check if System Restore is enabled for the main drive
|
||||
try {
|
||||
# Try getting restore points to check if System Restore is enabled
|
||||
@ -2690,72 +2663,72 @@
|
||||
}
|
||||
# Check if OneDrive got Uninstalled
|
||||
if (-not (Test-Path $regPath)) {
|
||||
Write-Host \"Copy downloaded Files from the OneDrive Folder to Root UserProfile\"
|
||||
Start-Process -FilePath powershell -ArgumentList \"robocopy '$($OneDrivePath)' '$($env:USERPROFILE.TrimEnd())\\' /mov /e /xj\" -NoNewWindow -Wait
|
||||
Write-Host \"Copy downloaded Files from the OneDrive Folder to Root UserProfile\"
|
||||
Start-Process -FilePath powershell -ArgumentList \"robocopy '$($OneDrivePath)' '$($env:USERPROFILE.TrimEnd())\\' /mov /e /xj\" -NoNewWindow -Wait
|
||||
|
||||
Write-Host \"Removing OneDrive leftovers\"
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\Microsoft\\OneDrive\"
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\OneDrive\"
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:programdata\\Microsoft OneDrive\"
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:systemdrive\\OneDriveTemp\"
|
||||
reg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\OneDrive\" -f
|
||||
# check if directory is empty before removing:
|
||||
If ((Get-ChildItem \"$OneDrivePath\" -Recurse | Measure-Object).Count -eq 0) {
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$OneDrivePath\"
|
||||
}
|
||||
Write-Host \"Removing OneDrive leftovers\"
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\Microsoft\\OneDrive\"
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\OneDrive\"
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:programdata\\Microsoft OneDrive\"
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:systemdrive\\OneDriveTemp\"
|
||||
reg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\OneDrive\" -f
|
||||
# check if directory is empty before removing:
|
||||
If ((Get-ChildItem \"$OneDrivePath\" -Recurse | Measure-Object).Count -eq 0) {
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$OneDrivePath\"
|
||||
}
|
||||
|
||||
Write-Host \"Remove Onedrive from explorer sidebar\"
|
||||
Set-ItemProperty -Path \"HKCR:\\CLSID\\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\" -Name \"System.IsPinnedToNameSpaceTree\" -Value 0
|
||||
Set-ItemProperty -Path \"HKCR:\\Wow6432Node\\CLSID\\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\" -Name \"System.IsPinnedToNameSpaceTree\" -Value 0
|
||||
Write-Host \"Remove Onedrive from explorer sidebar\"
|
||||
Set-ItemProperty -Path \"HKCR:\\CLSID\\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\" -Name \"System.IsPinnedToNameSpaceTree\" -Value 0
|
||||
Set-ItemProperty -Path \"HKCR:\\Wow6432Node\\CLSID\\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\" -Name \"System.IsPinnedToNameSpaceTree\" -Value 0
|
||||
|
||||
Write-Host \"Removing run hook for new users\"
|
||||
reg load \"hku\\Default\" \"C:\\Users\\Default\\NTUSER.DAT\"
|
||||
reg delete \"HKEY_USERS\\Default\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDriveSetup\" /f
|
||||
reg unload \"hku\\Default\"
|
||||
Write-Host \"Removing run hook for new users\"
|
||||
reg load \"hku\\Default\" \"C:\\Users\\Default\\NTUSER.DAT\"
|
||||
reg delete \"HKEY_USERS\\Default\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDriveSetup\" /f
|
||||
reg unload \"hku\\Default\"
|
||||
|
||||
Write-Host \"Removing autostart key\"
|
||||
reg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDrive\" /f
|
||||
Write-Host \"Removing autostart key\"
|
||||
reg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDrive\" /f
|
||||
|
||||
Write-Host \"Removing startmenu entry\"
|
||||
Remove-Item -Force -ErrorAction SilentlyContinue \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\OneDrive.lnk\"
|
||||
Write-Host \"Removing startmenu entry\"
|
||||
Remove-Item -Force -ErrorAction SilentlyContinue \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\OneDrive.lnk\"
|
||||
|
||||
Write-Host \"Removing scheduled task\"
|
||||
Get-ScheduledTask -TaskPath '\\' -TaskName 'OneDrive*' -ea SilentlyContinue | Unregister-ScheduledTask -Confirm:$false
|
||||
Write-Host \"Removing scheduled task\"
|
||||
Get-ScheduledTask -TaskPath '\\' -TaskName 'OneDrive*' -ea SilentlyContinue | Unregister-ScheduledTask -Confirm:$false
|
||||
|
||||
# Add Shell folders restoring default locations
|
||||
Write-Host \"Shell Fixing\"
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"AppData\" -Value \"$env:userprofile\\AppData\\Roaming\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Cache\" -Value \"$env:userprofile\\AppData\\Local\\Microsoft\\Windows\\INetCache\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Cookies\" -Value \"$env:userprofile\\AppData\\Local\\Microsoft\\Windows\\INetCookies\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Favorites\" -Value \"$env:userprofile\\Favorites\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"History\" -Value \"$env:userprofile\\AppData\\Local\\Microsoft\\Windows\\History\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Local AppData\" -Value \"$env:userprofile\\AppData\\Local\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"My Music\" -Value \"$env:userprofile\\Music\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"My Video\" -Value \"$env:userprofile\\Videos\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"NetHood\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Network Shortcuts\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"PrintHood\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Printer Shortcuts\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Programs\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Recent\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Recent\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"SendTo\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\SendTo\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Start Menu\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Startup\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Templates\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Templates\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{374DE290-123F-4565-9164-39C4925E467B}\" -Value \"$env:userprofile\\Downloads\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Desktop\" -Value \"$env:userprofile\\Desktop\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"My Pictures\" -Value \"$env:userprofile\\Pictures\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Personal\" -Value \"$env:userprofile\\Documents\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{F42EE2D3-909F-4907-8871-4C22FC0BF756}\" -Value \"$env:userprofile\\Documents\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{0DDD015D-B06C-45D5-8C4C-F59713854639}\" -Value \"$env:userprofile\\Pictures\" -Type ExpandString
|
||||
Write-Host \"Restarting explorer\"
|
||||
taskkill.exe /F /IM \"explorer.exe\"
|
||||
Start-Process \"explorer.exe\"
|
||||
# Add Shell folders restoring default locations
|
||||
Write-Host \"Shell Fixing\"
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"AppData\" -Value \"$env:userprofile\\AppData\\Roaming\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Cache\" -Value \"$env:userprofile\\AppData\\Local\\Microsoft\\Windows\\INetCache\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Cookies\" -Value \"$env:userprofile\\AppData\\Local\\Microsoft\\Windows\\INetCookies\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Favorites\" -Value \"$env:userprofile\\Favorites\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"History\" -Value \"$env:userprofile\\AppData\\Local\\Microsoft\\Windows\\History\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Local AppData\" -Value \"$env:userprofile\\AppData\\Local\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"My Music\" -Value \"$env:userprofile\\Music\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"My Video\" -Value \"$env:userprofile\\Videos\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"NetHood\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Network Shortcuts\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"PrintHood\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Printer Shortcuts\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Programs\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Recent\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Recent\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"SendTo\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\SendTo\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Start Menu\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Startup\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Templates\" -Value \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Templates\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{374DE290-123F-4565-9164-39C4925E467B}\" -Value \"$env:userprofile\\Downloads\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Desktop\" -Value \"$env:userprofile\\Desktop\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"My Pictures\" -Value \"$env:userprofile\\Pictures\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"Personal\" -Value \"$env:userprofile\\Documents\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{F42EE2D3-909F-4907-8871-4C22FC0BF756}\" -Value \"$env:userprofile\\Documents\" -Type ExpandString
|
||||
Set-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\" -Name \"{0DDD015D-B06C-45D5-8C4C-F59713854639}\" -Value \"$env:userprofile\\Pictures\" -Type ExpandString
|
||||
Write-Host \"Restarting explorer\"
|
||||
taskkill.exe /F /IM \"explorer.exe\"
|
||||
Start-Process \"explorer.exe\"
|
||||
|
||||
Write-Host \"Waiting for explorer to complete loading\"
|
||||
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
|
||||
Start-Sleep 5
|
||||
Write-Host \"Waiting for explorer to complete loading\"
|
||||
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
|
||||
Start-Sleep 5
|
||||
} 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
|
||||
}
|
||||
"
|
||||
],
|
||||
@ -3441,7 +3414,7 @@
|
||||
"panel": "1",
|
||||
"Order": "a040_",
|
||||
"Type": "Combobox",
|
||||
"ComboItems": "Default DHCP Google Cloudflare Cloudflare_Malware Cloudflare_Malware_Adult Open_DNS Quad9 AdGuard_Ads_Trackers AdGuard_Ads_Trackers_Malware_Adult",
|
||||
"ComboItems": "Default DHCP Google Cloudflare Cloudflare_Malware Cloudflare_Malware_Adult Open_DNS Quad9 AdGuard_Ads_Trackers AdGuard_Ads_Trackers_Malware_Adult dns0.eu_Open dns0.eu_ZERO dns0.eu_KIDS",
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/changedns"
|
||||
},
|
||||
"WPFAddUltPerf": {
|
||||
|
@ -1,3 +1,117 @@
|
||||
--8<-- ".github/CONTRIBUTING.md"
|
||||
# How to Contribute?
|
||||
|
||||
<!-- The content is sourced from "CONTRIBUTING.md," located in the root directory of the project. -->
|
||||
## Testing
|
||||
|
||||
* Test the latest changes to WinUtil by running the pre-release and reporting issues you are encountering to help us continually improve WinUtil!
|
||||
|
||||
#### **Run the latest pre-release**
|
||||
```ps1
|
||||
irm christitus.com/windev | iex
|
||||
```
|
||||
|
||||
!!! bug "Keep in mind"
|
||||
|
||||
This is a pre-release and should be treated as such. It exists for developers to test the utility and report or fix bugs before they get added to the stable release. Don't use it in production!
|
||||
|
||||
## Issues
|
||||
|
||||
* If you encounter any challenges or problems with the script, I kindly request that you submit them via the "Issues" tab on the GitHub repository. By filling out the provided template, you can provide specific details about the issue, allowing me (and others in the community) to promptly address any bugs or consider feature requests.
|
||||
|
||||
## Contribute Code
|
||||
|
||||
* Pull requests are now handled directly on the **MAIN branch**. This was done since we can now select specific releases to launch via releases in GitHub.
|
||||
|
||||
* If you're doing code changes, then you can submit a PR to `main` branch, but I am very selective about these.
|
||||
|
||||
!!! warning "Important"
|
||||
|
||||
Do not use a code formatter, make massive amounts of line changes, or make multiple feature changes. EACH FEATURE CHANGE SHOULD BE IT'S OWN PULL REQUEST!
|
||||
|
||||
* When creating pull requests, it is essential to thoroughly document all changes made. This includes, but is not limited to, documenting any additions made to the `tweaks` section and corresponding `undo tweak`, so users are able to remove the newly added tweaks if necessary, and comprehensive documentation is required for all code changes. Document your changes and briefly explain why you made your changes in your Pull Request Description. Failure to adhere to this format may result in the denial of the pull request. Additionally, any code lacking sufficient documentation may also be denied.
|
||||
|
||||
* By following these guidelines, we can maintain a high standard of quality and ensure that the codebase remains organized and well-documented.
|
||||
|
||||
!!! note
|
||||
|
||||
When creating a function, please include "WPF" or "WinUtil" in the file name so it can be loaded into the runspace.
|
||||
|
||||
## Walk through
|
||||
|
||||
* This is a guide for beginners. If you are still having issues, look at the following official GitHub documentation:
|
||||
* [Commit through WEB](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/about-commits)
|
||||
* [Commit through GitHub Desktop](https://docs.github.com/en/desktop/making-changes-in-a-branch/committing-and-reviewing-changes-to-your-project-in-github-desktop#about-commits)
|
||||
* [Create a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)
|
||||
|
||||
|
||||
### Overview
|
||||
|
||||
``` mermaid
|
||||
%%{init: {"flowchart": {"curve": "cardinal"}} }%%
|
||||
graph TD
|
||||
A[Fork Project] --> B[Clone Repository];
|
||||
B --> C[Create New Branch];
|
||||
C --> D[Make Changes];
|
||||
D --> G[Test Changes];
|
||||
G --> H{Tests Passed?};
|
||||
H -->|Yes| E[Commit Changes];
|
||||
H -->|No| J[Fix Issues];
|
||||
J --> G;
|
||||
E --> F[Push Branch];
|
||||
F --> K[Create Pull Request];
|
||||
K --> L[Fill out PR template];
|
||||
classDef default stroke:#333,stroke-width:4px,font-size:12pt;
|
||||
```
|
||||
!!! info
|
||||
|
||||
This is a diagram to guide you through the process. It may vary depending on the type of change you're making.
|
||||
|
||||
### Fork the Repo
|
||||
* Fork the WinUtil Repository [here](https://github.com/ChrisTitusTech/winutil) to create a copy that will be available in your repository list.
|
||||
|
||||
![Fork Image](assets/Fork-Button-Dark.png#only-dark#gh-dark-mode-only)
|
||||
|
||||
![Fork Image](assets/Fork-Button-Light.png#only-light#gh-light-mode-only)
|
||||
|
||||
### Clone the Fork
|
||||
!!! tip
|
||||
|
||||
While you can make your changes directly through the Web, we recommend cloning the repo to your device using the application GitHub Desktop (available in WinUtil) to test your fork easily.
|
||||
|
||||
* Install GitHub Desktop if it is not already installed.
|
||||
* Log in using the same GitHub account you used to fork WinUtil.
|
||||
* Choose the fork under "Your Repositories" and press "clone {repo name}"
|
||||
* Create a new branch and name it something relatable to your changes.
|
||||
|
||||
* Now you can modify WinUtil to your liking using your preferred text editor.
|
||||
|
||||
|
||||
### Testing your changes
|
||||
|
||||
* To test to see if your changes work as intended run following commands in a powershell teminal as admin:
|
||||
|
||||
* Change the directory where you are running the commands to the forked project.
|
||||
* `cd {path to the folder with the compile.ps1}`
|
||||
* Run the following command to compile and run WinUtil:
|
||||
* `.\Compile.ps1 -run`
|
||||
|
||||
![Compile](assets/Compile.png)
|
||||
|
||||
* After seeing that your changes work properly, feel free to commit the changes to the repository and make a PR. For help on that, follow the documentation below.
|
||||
|
||||
### Committing the changes
|
||||
* Before committing your changes, please discard changes made to the `winutil.ps1` file, like the following:
|
||||
|
||||
![Push Commit Image](assets/Discard-GHD.png)
|
||||
|
||||
* Now, commit your changes once you are happy with the result.
|
||||
|
||||
![Commit Image](assets/Commit-GHD.png)
|
||||
|
||||
* Push the changes to upload them to your fork on github.com.
|
||||
|
||||
![Push Commit Image](assets/Push-Commit.png)
|
||||
|
||||
### Making a PR
|
||||
* To make a PR on your repo under a new branch linking to the main branch, a button will show and say Preview and Create pull request. Click that button and fill in all the information that is provided on the template. Once all the information is filled in correctly, check your PR to make sure there is not a WinUtil.ps1 file attached to the PR. Once everything is good, make the PR and wait for Chris (the maintainer) to accept or deny your PR. Once it is accepted by Chris, you will be able to see your changes in the "/windev" build.
|
||||
* If you do not see your feature in the main "/win" build, that is fine. All new changes go into the /windev build to make sure everything is working OK before going fully public.
|
||||
* Congratulations! You just submitted your first PR. Thank you so much for contributing to WinUtil.
|
||||
|
@ -34,8 +34,9 @@
|
||||
* By default Winutil will use winget to install/upgrade/remove packages and fallback to Chocolatey. This option reverses the preference.
|
||||
* This preference will be used for all Buttons on the Install page and persist across Winutil restarts
|
||||
|
||||
![Install Image](assets/Install-Tab-Dark.png#only-dark)
|
||||
![Install Image](assets/Install-Tab-Light.png#only-light)
|
||||
![Install Image](assets/Install-Tab-Dark.png#only-dark#gh-dark-mode-only)
|
||||
![Install Image](assets/Install-Tab-Light.png#only-light#gh-light-mode-only)
|
||||
|
||||
!!! tip
|
||||
|
||||
If you have trouble finding an application, press `ctrl + f` and search the name of it. Applications will filter depending on your input.
|
||||
@ -43,8 +44,8 @@
|
||||
## Tweaks
|
||||
---
|
||||
|
||||
![Tweaks Image](assets/Tweaks-Tab-Dark.png#only-dark)
|
||||
![Tweaks Image](assets/Tweaks-Tab-Light.png#only-light)
|
||||
![Tweaks Image](assets/Tweaks-Tab-Dark.png#only-dark#gh-dark-mode-only)
|
||||
![Tweaks Image](assets/Tweaks-Tab-Light.png#only-light#gh-light-mode-only)
|
||||
|
||||
### Run Tweaks
|
||||
* **Open Tweaks Tab**: Navigate to the 'Tweaks' tab in the application.
|
||||
@ -141,6 +142,10 @@ Open old-school Windows panels directly from WinUtil. Following Panels are avail
|
||||
* System Properties
|
||||
* User Accounts
|
||||
|
||||
### Remote Access
|
||||
|
||||
Enables OpenSSH server on your windows machine.
|
||||
|
||||
## Updates
|
||||
---
|
||||
|
||||
@ -175,8 +180,8 @@ The utility provides three distinct settings for managing Windows updates: Defau
|
||||
|
||||
* **MicroWin** lets you customize your Windows 10 and 11 installation images by debloating them however you want.
|
||||
|
||||
![Microwin](assets/Microwin-Dark.png#only-dark)
|
||||
![Microwin](assets/Microwin-Light.png#only-light)
|
||||
![Microwin](assets/Microwin-Dark.png#only-dark#gh-dark-mode-only)
|
||||
![Microwin](assets/Microwin-Light.png#only-light#gh-light-mode-only)
|
||||
|
||||
#### Basic usage
|
||||
|
||||
@ -234,12 +239,12 @@ With MicroWin, you can also configure your user before proceeding if you don't w
|
||||
* Some features are available through automation. This allows you to save your config file, pass it to WinUtil, walk away and come back to a finished system. Here is how you can set it up currently with Winutil >24.01.15
|
||||
|
||||
* On the Install Tab, click "Get Installed", this will get all installed apps **supported by Winutil** on the system.
|
||||
![GetInstalled](assets/Get-Installed-Dark.png#only-dark)
|
||||
![GetInstalled](assets/Get-Installed-Light.png#only-light)
|
||||
![GetInstalled](assets/Get-Installed-Dark.png#only-dark#gh-dark-mode-only)
|
||||
![GetInstalled](assets/Get-Installed-Light.png#only-light#gh-light-mode-only)
|
||||
|
||||
* Click on the Settings cog in the upper right corner and choose Export. Choose file file and location; this will export the setting file.
|
||||
![SettingsExport](assets/Settings-Export-Dark.png#only-dark)
|
||||
![SettingsExport](assets/Settings-Export-Light.png#only-light)
|
||||
![SettingsExport](assets/Settings-Export-Dark.png#only-dark#gh-dark-mode-only)
|
||||
![SettingsExport](assets/Settings-Export-Light.png#only-light#gh-light-mode-only)
|
||||
|
||||
* Copy this file to a USB or somewhere you can use it after Windows installation.
|
||||
|
||||
|
@ -19,10 +19,10 @@ function Copy-Files {
|
||||
try {
|
||||
|
||||
$files = Get-ChildItem -Path $path -Recurse:$recurse
|
||||
Write-Host "Copy $($files.Count)(s) from $path to $destination"
|
||||
Write-Host "Copy $($files.Count) file(s) from $path to $destination"
|
||||
|
||||
foreach ($file in $files) {
|
||||
$status = "Copy files {0} on {1}: {2}" -f $counter, $files.Count, $file.Name
|
||||
$status = "Copying file {0} of {1}: {2}" -f $counter, $files.Count, $file.Name
|
||||
Write-Progress -Activity "Copy Windows files" -Status $status -PercentComplete ($counter++/$files.count*100)
|
||||
$restpath = $file.FullName -Replace $path, ''
|
||||
|
||||
@ -37,7 +37,11 @@ function Copy-Files {
|
||||
}
|
||||
Write-Progress -Activity "Copy Windows files" -Status "Ready" -Completed
|
||||
} catch {
|
||||
Write-Warning "Unable to Copy all the files due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
Write-Host "Unable to Copy all the files due to an unhandled exception" -ForegroundColor Yellow
|
||||
Write-Host "Error information: $($_.Exception.Message)`n" -ForegroundColor Yellow
|
||||
Write-Host "Additional information:" -ForegroundColor Yellow
|
||||
Write-Host $PSItem.Exception.StackTrace
|
||||
# Write possible suggestions
|
||||
Write-Host "`nIf you are using an antivirus, try configuring exclusions"
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,17 @@ function Test-CompatibleImage() {
|
||||
}
|
||||
}
|
||||
|
||||
class ErroredPackage {
|
||||
[string]$PackageName
|
||||
[string]$ErrorMessage
|
||||
ErroredPackage() { $this.Init(@{} )}
|
||||
# Constructor for packages that have errored out
|
||||
ErroredPackage([string]$pkgName, [string]$reason) {
|
||||
$this.PackageName = $pkgName
|
||||
$this.ErrorMessage = $reason
|
||||
}
|
||||
}
|
||||
|
||||
function Get-FidoLangFromCulture {
|
||||
|
||||
param (
|
||||
@ -98,6 +109,8 @@ function Remove-Features() {
|
||||
$_.FeatureName -NotLike "*Media*" -AND
|
||||
$_.FeatureName -NotLike "*NFS*" -AND
|
||||
$_.FeatureName -NotLike "*SearchEngine*" -AND
|
||||
$_.FeatureName -NotLike "*RemoteDesktop*" -AND
|
||||
$_.FeatureName -NotLike "*Recall*" -AND
|
||||
$_.State -ne "Disabled"
|
||||
}
|
||||
|
||||
@ -145,6 +158,7 @@ function Remove-Packages {
|
||||
$_ -NotLike "*ParentalControls*" -AND
|
||||
$_ -NotLike "*Win32WebViewHost*" -AND
|
||||
$_ -NotLike "*InputApp*" -AND
|
||||
$_ -NotLike "*DirectPlay*" -AND
|
||||
$_ -NotLike "*AccountsControl*" -AND
|
||||
$_ -NotLike "*AsyncTextService*" -AND
|
||||
$_ -NotLike "*CapturePicker*" -AND
|
||||
@ -156,27 +170,54 @@ function Remove-Packages {
|
||||
$_ -NotLike "*WMIC*" -AND
|
||||
$_ -NotLike "*UI.XaML*" -AND
|
||||
$_ -NotLike "*Ethernet*" -AND
|
||||
$_ -NotLike "*Wifi*"
|
||||
$_ -NotLike "*Wifi*" -AND
|
||||
$_ -NotLike "*FodMetadata*" -AND
|
||||
$_ -NotLike "*Foundation*" -AND
|
||||
$_ -NotLike "*LanguageFeatures*" -AND
|
||||
$_ -NotLike "*VBSCRIPT*" -AND
|
||||
$_ -NotLike "*License*"
|
||||
}
|
||||
|
||||
$failedCount = 0
|
||||
|
||||
$erroredPackages = [System.Collections.Generic.List[ErroredPackage]]::new()
|
||||
|
||||
foreach ($pkg in $pkglist) {
|
||||
try {
|
||||
$status = "Removing $pkg"
|
||||
Write-Progress -Activity "Removing Apps" -Status $status -PercentComplete ($counter++/$pkglist.Count*100)
|
||||
Write-Progress -Activity "Removing Packages" -Status $status -PercentComplete ($counter++/$pkglist.Count*100)
|
||||
Remove-WindowsPackage -Path "$scratchDir" -PackageName $pkg -NoRestart -ErrorAction SilentlyContinue
|
||||
} catch {
|
||||
# This can happen if the package that is being removed is a permanent one, like FodMetadata
|
||||
Write-Host "Could not remove OS package $($pkg)"
|
||||
# This can happen if the package that is being removed is a permanent one
|
||||
$erroredPackages.Add([ErroredPackage]::new($pkg, $_.Exception.Message))
|
||||
$failedCount += 1
|
||||
continue
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed
|
||||
Write-Progress -Activity "Removing Packages" -Status "Ready" -Completed
|
||||
if ($failedCount -gt 0)
|
||||
{
|
||||
Write-Host "Some packages could not be removed. Do not worry: your image will still work fine. This can happen if the package is permanent or has been superseded by a newer one."
|
||||
Write-Host "$failedCount package(s) could not be removed. Your image will still work fine, however. Below is information on what packages failed to be removed and why."
|
||||
if ($erroredPackages.Count -gt 0)
|
||||
{
|
||||
$erroredPackages = $erroredPackages | Sort-Object -Property ErrorMessage
|
||||
|
||||
$previousErroredPackage = $erroredPackages[0]
|
||||
$counter = 0
|
||||
Write-Host ""
|
||||
Write-Host "- $($previousErroredPackage.ErrorMessage)"
|
||||
foreach ($erroredPackage in $erroredPackages) {
|
||||
if ($erroredPackage.ErrorMessage -ne $previousErroredPackage.ErrorMessage) {
|
||||
Write-Host ""
|
||||
$counter = 0
|
||||
Write-Host "- $($erroredPackage.ErrorMessage)"
|
||||
}
|
||||
$counter += 1
|
||||
Write-Host " $counter) $($erroredPackage.PackageName)"
|
||||
$previousErroredPackage = $erroredPackage
|
||||
}
|
||||
Write-Host ""
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Unable to get information about the packages. MicroWin processing will continue, but packages will not be processed"
|
||||
@ -200,13 +241,8 @@ function Remove-ProvisionedPackages() {
|
||||
$appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object {
|
||||
$_.PackageName -NotLike "*AppInstaller*" -AND
|
||||
$_.PackageName -NotLike "*Store*" -and
|
||||
$_.PackageName -NotLike "*dism*" -and
|
||||
$_.PackageName -NotLike "*Foundation*" -and
|
||||
$_.PackageName -NotLike "*FodMetadata*" -and
|
||||
$_.PackageName -NotLike "*LanguageFeatures*" -and
|
||||
$_.PackageName -NotLike "*Notepad*" -and
|
||||
$_.PackageName -NotLike "*Printing*" -and
|
||||
$_.PackageName -NotLike "*Foundation*" -and
|
||||
$_.PackageName -NotLike "*YourPhone*" -and
|
||||
$_.PackageName -NotLike "*Xbox*" -and
|
||||
$_.PackageName -NotLike "*WindowsTerminal*" -and
|
||||
@ -624,70 +660,70 @@ function New-CheckInstall {
|
||||
# using here string to embedd firstrun
|
||||
$checkInstall = @'
|
||||
@echo off
|
||||
if exist "C:\windows\cpu.txt" (
|
||||
echo C:\windows\cpu.txt exists
|
||||
if exist "%HOMEDRIVE%\windows\cpu.txt" (
|
||||
echo %HOMEDRIVE%\windows\cpu.txt exists
|
||||
) else (
|
||||
echo C:\windows\cpu.txt does not exist
|
||||
echo %HOMEDRIVE%\windows\cpu.txt does not exist
|
||||
)
|
||||
if exist "C:\windows\SerialNumber.txt" (
|
||||
echo C:\windows\SerialNumber.txt exists
|
||||
if exist "%HOMEDRIVE%\windows\SerialNumber.txt" (
|
||||
echo %HOMEDRIVE%\windows\SerialNumber.txt exists
|
||||
) else (
|
||||
echo C:\windows\SerialNumber.txt does not exist
|
||||
echo %HOMEDRIVE%\windows\SerialNumber.txt does not exist
|
||||
)
|
||||
if exist "C:\unattend.xml" (
|
||||
echo C:\unattend.xml exists
|
||||
if exist "%HOMEDRIVE%\unattend.xml" (
|
||||
echo %HOMEDRIVE%\unattend.xml exists
|
||||
) else (
|
||||
echo C:\unattend.xml does not exist
|
||||
echo %HOMEDRIVE%\unattend.xml does not exist
|
||||
)
|
||||
if exist "C:\Windows\Setup\Scripts\SetupComplete.cmd" (
|
||||
echo C:\Windows\Setup\Scripts\SetupComplete.cmd exists
|
||||
if exist "%HOMEDRIVE%\Windows\Setup\Scripts\SetupComplete.cmd" (
|
||||
echo %HOMEDRIVE%\Windows\Setup\Scripts\SetupComplete.cmd exists
|
||||
) else (
|
||||
echo C:\Windows\Setup\Scripts\SetupComplete.cmd does not exist
|
||||
echo %HOMEDRIVE%\Windows\Setup\Scripts\SetupComplete.cmd does not exist
|
||||
)
|
||||
if exist "C:\Windows\Panther\unattend.xml" (
|
||||
echo C:\Windows\Panther\unattend.xml exists
|
||||
if exist "%HOMEDRIVE%\Windows\Panther\unattend.xml" (
|
||||
echo %HOMEDRIVE%\Windows\Panther\unattend.xml exists
|
||||
) else (
|
||||
echo C:\Windows\Panther\unattend.xml does not exist
|
||||
echo %HOMEDRIVE%\Windows\Panther\unattend.xml does not exist
|
||||
)
|
||||
if exist "C:\Windows\System32\Sysprep\unattend.xml" (
|
||||
echo C:\Windows\System32\Sysprep\unattend.xml exists
|
||||
if exist "%HOMEDRIVE%\Windows\System32\Sysprep\unattend.xml" (
|
||||
echo %HOMEDRIVE%\Windows\System32\Sysprep\unattend.xml exists
|
||||
) else (
|
||||
echo C:\Windows\System32\Sysprep\unattend.xml does not exist
|
||||
echo %HOMEDRIVE%\Windows\System32\Sysprep\unattend.xml does not exist
|
||||
)
|
||||
if exist "C:\Windows\FirstStartup.ps1" (
|
||||
echo C:\Windows\FirstStartup.ps1 exists
|
||||
if exist "%HOMEDRIVE%\Windows\FirstStartup.ps1" (
|
||||
echo %HOMEDRIVE%\Windows\FirstStartup.ps1 exists
|
||||
) else (
|
||||
echo C:\Windows\FirstStartup.ps1 does not exist
|
||||
echo %HOMEDRIVE%\Windows\FirstStartup.ps1 does not exist
|
||||
)
|
||||
if exist "C:\Windows\winutil.ps1" (
|
||||
echo C:\Windows\winutil.ps1 exists
|
||||
if exist "%HOMEDRIVE%\Windows\winutil.ps1" (
|
||||
echo %HOMEDRIVE%\Windows\winutil.ps1 exists
|
||||
) else (
|
||||
echo C:\Windows\winutil.ps1 does not exist
|
||||
echo %HOMEDRIVE%\Windows\winutil.ps1 does not exist
|
||||
)
|
||||
if exist "C:\Windows\LogSpecialize.txt" (
|
||||
echo C:\Windows\LogSpecialize.txt exists
|
||||
if exist "%HOMEDRIVE%\Windows\LogSpecialize.txt" (
|
||||
echo %HOMEDRIVE%\Windows\LogSpecialize.txt exists
|
||||
) else (
|
||||
echo C:\Windows\LogSpecialize.txt does not exist
|
||||
echo %HOMEDRIVE%\Windows\LogSpecialize.txt does not exist
|
||||
)
|
||||
if exist "C:\Windows\LogAuditUser.txt" (
|
||||
echo C:\Windows\LogAuditUser.txt exists
|
||||
if exist "%HOMEDRIVE%\Windows\LogAuditUser.txt" (
|
||||
echo %HOMEDRIVE%\Windows\LogAuditUser.txt exists
|
||||
) else (
|
||||
echo C:\Windows\LogAuditUser.txt does not exist
|
||||
echo %HOMEDRIVE%\Windows\LogAuditUser.txt does not exist
|
||||
)
|
||||
if exist "C:\Windows\LogOobeSystem.txt" (
|
||||
echo C:\Windows\LogOobeSystem.txt exists
|
||||
if exist "%HOMEDRIVE%\Windows\LogOobeSystem.txt" (
|
||||
echo %HOMEDRIVE%\Windows\LogOobeSystem.txt exists
|
||||
) else (
|
||||
echo C:\Windows\LogOobeSystem.txt does not exist
|
||||
echo %HOMEDRIVE%\Windows\LogOobeSystem.txt does not exist
|
||||
)
|
||||
if exist "c:\windows\csup.txt" (
|
||||
echo c:\windows\csup.txt exists
|
||||
if exist "%HOMEDRIVE%\windows\csup.txt" (
|
||||
echo %HOMEDRIVE%\windows\csup.txt exists
|
||||
) else (
|
||||
echo c:\windows\csup.txt does not exist
|
||||
echo %HOMEDRIVE%\windows\csup.txt does not exist
|
||||
)
|
||||
if exist "c:\windows\LogFirstRun.txt" (
|
||||
echo c:\windows\LogFirstRun.txt exists
|
||||
if exist "%HOMEDRIVE%\windows\LogFirstRun.txt" (
|
||||
echo %HOMEDRIVE%\windows\LogFirstRun.txt exists
|
||||
) else (
|
||||
echo c:\windows\LogFirstRun.txt does not exist
|
||||
echo %HOMEDRIVE%\windows\LogFirstRun.txt does not exist
|
||||
)
|
||||
'@
|
||||
$checkInstall | Out-File -FilePath "$env:temp\checkinstall.cmd" -Force -Encoding Ascii
|
||||
@ -725,7 +761,7 @@ function New-FirstRun {
|
||||
}
|
||||
}
|
||||
|
||||
"FirstStartup has worked" | Out-File -FilePath c:\windows\LogFirstRun.txt -Append -NoClobber
|
||||
"FirstStartup has worked" | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber
|
||||
|
||||
$taskbarPath = "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
|
||||
# Delete all files on the Taskbar
|
||||
@ -745,7 +781,7 @@ function New-FirstRun {
|
||||
}
|
||||
}
|
||||
Remove-Item -Path "$env:USERPROFILE\Desktop\*.lnk"
|
||||
Remove-Item -Path "C:\Users\Default\Desktop\*.lnk"
|
||||
Remove-Item -Path "$env:HOMEDRIVE\Users\Default\Desktop\*.lnk"
|
||||
|
||||
# ************************************************
|
||||
# Create WinUtil shortcut on the desktop
|
||||
@ -761,8 +797,8 @@ function New-FirstRun {
|
||||
# Create a shortcut object
|
||||
$shortcut = $shell.CreateShortcut($shortcutPath)
|
||||
|
||||
if (Test-Path -Path "c:\Windows\cttlogo.png") {
|
||||
$shortcut.IconLocation = "c:\Windows\cttlogo.png"
|
||||
if (Test-Path -Path "$env:HOMEDRIVE\Windows\cttlogo.png") {
|
||||
$shortcut.IconLocation = "$env:HOMEDRIVE\Windows\cttlogo.png"
|
||||
}
|
||||
|
||||
# Set properties of the shortcut
|
||||
@ -782,8 +818,17 @@ function New-FirstRun {
|
||||
# Done create WinUtil shortcut on the desktop
|
||||
# ************************************************
|
||||
|
||||
Start-Process explorer
|
||||
try
|
||||
{
|
||||
if ((Get-WindowsOptionalFeature -Online | Where-Object { $_.FeatureName -like "Recall" }).Count -gt 0)
|
||||
{
|
||||
Disable-WindowsOptionalFeature -Online -FeatureName "Recall" -Remove
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
'@
|
||||
$firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force
|
||||
}
|
||||
|
81
functions/private/Invoke-WinUtilSSHServer.ps1
Normal file
81
functions/private/Invoke-WinUtilSSHServer.ps1
Normal file
@ -0,0 +1,81 @@
|
||||
function Invoke-WinUtilSSHServer {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Enables OpenSSH server to remote into your windows device
|
||||
#>
|
||||
|
||||
# Get the latest version of OpenSSH Server
|
||||
$FeatureName = Get-WindowsCapability -Online | Where-Object { $_.Name -like "OpenSSH.Server*" }
|
||||
|
||||
# Install the OpenSSH Server feature if not already installed
|
||||
if ($FeatureName.State -ne "Installed") {
|
||||
Write-Host "Enabling OpenSSH Server"
|
||||
Add-WindowsCapability -Online -Name $FeatureName.Name
|
||||
}
|
||||
|
||||
# Sets up the OpenSSH Server service
|
||||
Write-Host "Starting the services"
|
||||
Start-Service -Name sshd
|
||||
Set-Service -Name sshd -StartupType Automatic
|
||||
|
||||
# Sets up the ssh-agent service
|
||||
Start-Service 'ssh-agent'
|
||||
Set-Service -Name 'ssh-agent' -StartupType 'Automatic'
|
||||
|
||||
# Confirm the required services are running
|
||||
$SSHDaemonService = Get-Service -Name sshd
|
||||
$SSHAgentService = Get-Service -Name 'ssh-agent'
|
||||
|
||||
if ($SSHDaemonService.Status -eq 'Running') {
|
||||
Write-Host "OpenSSH Server is running."
|
||||
} else {
|
||||
try {
|
||||
Write-Host "OpenSSH Server is not running. Attempting to restart..."
|
||||
Restart-Service -Name sshd -Force
|
||||
Write-Host "OpenSSH Server has been restarted successfully."
|
||||
} catch {
|
||||
Write-Host "Failed to restart OpenSSH Server: $_"
|
||||
}
|
||||
}
|
||||
if ($SSHAgentService.Status -eq 'Running') {
|
||||
Write-Host "ssh-agent is running."
|
||||
} else {
|
||||
try {
|
||||
Write-Host "ssh-agent is not running. Attempting to restart..."
|
||||
Restart-Service -Name sshd -Force
|
||||
Write-Host "ssh-agent has been restarted successfully."
|
||||
} catch {
|
||||
Write-Host "Failed to restart ssh-agent : $_"
|
||||
}
|
||||
}
|
||||
|
||||
#Adding Firewall rule for port 22
|
||||
Write-Host "Setting up firewall rules"
|
||||
$firewallRule = (Get-NetFirewallRule -Name 'sshd').Enabled
|
||||
if ($firewallRule) {
|
||||
Write-Host "Firewall rule for OpenSSH Server (sshd) already exists."
|
||||
} else {
|
||||
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
|
||||
Write-Host "Firewall rule for OpenSSH Server created and enabled."
|
||||
}
|
||||
|
||||
# Check for the authorized_keys file
|
||||
$sshFolderPath = "$env:HOMEDRIVE\$env:HOMEPATH\.ssh"
|
||||
$authorizedKeysPath = "$sshFolderPath\authorized_keys"
|
||||
|
||||
if (-not (Test-Path -Path $sshFolderPath)) {
|
||||
Write-Host "Creating ssh directory..."
|
||||
New-Item -Path $sshFolderPath -ItemType Directory -Force
|
||||
}
|
||||
|
||||
if (-not (Test-Path -Path $authorizedKeysPath)) {
|
||||
Write-Host "Creating authorized_keys file..."
|
||||
New-Item -Path $authorizedKeysPath -ItemType File -Force
|
||||
Write-Host "authorized_keys file created at $authorizedKeysPath."
|
||||
} else {
|
||||
Write-Host "authorized_keys file already exists at $authorizedKeysPath."
|
||||
}
|
||||
Write-Host "OpenSSH server was successfully enabled."
|
||||
Write-Host "The config file can be located at C:\ProgramData\ssh\sshd_config "
|
||||
Write-Host "Add your public keys to this file -> $authorizedKeysPath"
|
||||
}
|
@ -36,7 +36,12 @@ function Set-WinUtilRegistry {
|
||||
}
|
||||
|
||||
Write-Host "Set $Path\$Name to $Value"
|
||||
Set-ItemProperty -Path $Path -Name $Name -Type $Type -Value $Value -Force -ErrorAction Stop | Out-Null
|
||||
if ($Value -ne "<RemoveEntry>") {
|
||||
Set-ItemProperty -Path $Path -Name $Name -Type $Type -Value $Value -Force -ErrorAction Stop | Out-Null
|
||||
}
|
||||
else{
|
||||
Remove-ItemProperty -Path $Path -Name $Name -Force -ErrorAction Stop | Out-Null
|
||||
}
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
|
@ -58,5 +58,6 @@ function Invoke-WPFButton {
|
||||
"WPFCloseButton" {Invoke-WPFCloseButton}
|
||||
"MicrowinScratchDirBT" {Invoke-ScratchDialog}
|
||||
"WPFWinUtilPSProfile" {Invoke-WinUtilpsProfile}
|
||||
"WPFWinUtilSSHServer" {Invoke-WinUtilSSHServer}
|
||||
}
|
||||
}
|
||||
|
@ -19,44 +19,59 @@ function Invoke-WPFImpex {
|
||||
$Config = $null
|
||||
)
|
||||
|
||||
if ($type -eq "export") {
|
||||
$FileBrowser = New-Object System.Windows.Forms.SaveFileDialog
|
||||
}
|
||||
if ($type -eq "import") {
|
||||
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog
|
||||
}
|
||||
function ConfigDialog {
|
||||
if (!$Config) {
|
||||
switch ($type) {
|
||||
"export" { $FileBrowser = New-Object System.Windows.Forms.SaveFileDialog }
|
||||
"import" { $FileBrowser = New-Object System.Windows.Forms.OpenFileDialog }
|
||||
}
|
||||
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
||||
$FileBrowser.Filter = "JSON Files (*.json)|*.json"
|
||||
$FileBrowser.ShowDialog() | Out-Null
|
||||
|
||||
if (-not $Config) {
|
||||
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
||||
$FileBrowser.Filter = "JSON Files (*.json)|*.json"
|
||||
$FileBrowser.ShowDialog() | Out-Null
|
||||
|
||||
if($FileBrowser.FileName -eq "") {
|
||||
return
|
||||
if ($FileBrowser.FileName -eq "") {
|
||||
return $null
|
||||
} else {
|
||||
return $FileBrowser.FileName
|
||||
}
|
||||
} else {
|
||||
$Config = $FileBrowser.FileName
|
||||
return $Config
|
||||
}
|
||||
}
|
||||
|
||||
if ($type -eq "export") {
|
||||
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false
|
||||
$jsonFile | ConvertTo-Json | Out-File $FileBrowser.FileName -Force
|
||||
$runscript = "iex ""& { `$(irm christitus.com/win) } -Config '$($FileBrowser.FileName)'"""
|
||||
$runscript | Set-Clipboard
|
||||
}
|
||||
if ($type -eq "import") {
|
||||
$jsonFile = Get-Content $Config | ConvertFrom-Json
|
||||
|
||||
$flattenedJson = @()
|
||||
$jsonFile.PSObject.Properties | ForEach-Object {
|
||||
$category = $_.Name
|
||||
foreach ($checkboxName in $_.Value) {
|
||||
if ($category -ne "Install") {
|
||||
$flattenedJson += $checkboxName
|
||||
switch ($type) {
|
||||
"export" {
|
||||
try {
|
||||
$Config = ConfigDialog
|
||||
if ($Config) {
|
||||
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false | ConvertTo-Json
|
||||
$jsonFile | Out-File $Config -Force
|
||||
"iex ""& { `$(irm christitus.com/win) } -Config '$Config'""" | Set-Clipboard
|
||||
}
|
||||
} catch {
|
||||
Write-Error "An error occurred while exporting: $_"
|
||||
}
|
||||
}
|
||||
"import" {
|
||||
try {
|
||||
$Config = ConfigDialog
|
||||
if ($Config) {
|
||||
try {
|
||||
if ($Config -match '^https?://') {
|
||||
$jsonFile = (Invoke-WebRequest "$Config").Content | ConvertFrom-Json
|
||||
} else {
|
||||
$jsonFile = Get-Content $Config | ConvertFrom-Json
|
||||
}
|
||||
} catch {
|
||||
Write-Error "Failed to load the JSON file from the specified path or URL: $_"
|
||||
return
|
||||
}
|
||||
$flattenedJson = $jsonFile.PSObject.Properties.Where({ $_.Name -ne "Install" }).ForEach({ $_.Value })
|
||||
Invoke-WPFPresets -preset $flattenedJson -imported $true
|
||||
}
|
||||
} catch {
|
||||
Write-Error "An error occurred while importing: $_"
|
||||
}
|
||||
}
|
||||
|
||||
Invoke-WPFPresets -preset $flattenedJson -imported $true
|
||||
}
|
||||
}
|
||||
|
@ -51,10 +51,6 @@ public class PowerManagement {
|
||||
$index = $sync.MicrowinWindowsFlavors.SelectedValue.Split(":")[0].Trim()
|
||||
Write-Host "Index chosen: '$index' from $($sync.MicrowinWindowsFlavors.SelectedValue)"
|
||||
|
||||
$keepPackages = $sync.WPFMicrowinKeepProvisionedPackages.IsChecked
|
||||
$keepProvisionedPackages = $sync.WPFMicrowinKeepAppxPackages.IsChecked
|
||||
$keepDefender = $sync.WPFMicrowinKeepDefender.IsChecked
|
||||
$keepEdge = $sync.WPFMicrowinKeepEdge.IsChecked
|
||||
$copyToUSB = $sync.WPFMicrowinCopyToUsb.IsChecked
|
||||
$injectDrivers = $sync.MicrowinInjectDrivers.IsChecked
|
||||
$importDrivers = $sync.MicrowinImportDrivers.IsChecked
|
||||
@ -91,6 +87,14 @@ public class PowerManagement {
|
||||
return
|
||||
}
|
||||
|
||||
# Detect whether the image to process contains Windows 10 and show warning
|
||||
if ((Test-CompatibleImage $imgVersion $([System.Version]::new(10,0,21996,1))) -eq $false) {
|
||||
$msg = "Windows 10 has been detected in the image you want to process. While you can continue, Windows 10 is not a recommended target for MicroWin, and you may not get the full experience."
|
||||
$dlg_msg = $msg
|
||||
Write-Host $msg
|
||||
[System.Windows.MessageBox]::Show($dlg_msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Exclamation)
|
||||
}
|
||||
|
||||
$mountDirExists = Test-Path $mountDir
|
||||
$scratchDirExists = Test-Path $scratchDir
|
||||
if (-not $mountDirExists -or -not $scratchDirExists) {
|
||||
@ -238,6 +242,9 @@ public class PowerManagement {
|
||||
# Write-Host Error code $LASTEXITCODE
|
||||
Write-Host "Done disabling Teams"
|
||||
|
||||
Write-Host "Fix Windows Volume Mixer Issue"
|
||||
reg add "HKLM\zNTUSER\Software\Microsoft\Internet Explorer\LowRegistry\Audio\PolicyConfig\PropertyStore" /f
|
||||
|
||||
Write-Host "Bypassing system requirements (system image)"
|
||||
reg add "HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV1" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d 0 /f
|
||||
@ -289,6 +296,19 @@ public class PowerManagement {
|
||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "AppsUseLightTheme" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "SystemUsesLightTheme" /t REG_DWORD /d 0 /f
|
||||
|
||||
if ((Test-CompatibleImage $imgVersion $([System.Version]::new(10,0,21996,1))) -eq $false) {
|
||||
# We're dealing with Windows 10. Configure sane desktop settings. NOTE: even though stuff to disable News and Interests is there,
|
||||
# it doesn't seem to work, and I don't want to waste more time dealing with an operating system that will lose support in a year (2025)
|
||||
|
||||
# I invite anyone to work on improving stuff for News and Interests, but that won't be me!
|
||||
|
||||
Write-Host "Disabling Search Highlights..."
|
||||
reg add "HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Feeds\DSB" /v "ShowDynamicContent" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\SearchSettings" /v "IsDynamicSearchBoxEnabled" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\zSOFTWARE\Policies\Microsoft\Dsh" /v "AllowNewsAndInterests" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "TraySearchBoxVisible" /t REG_DWORD /d 1 /f
|
||||
}
|
||||
|
||||
} catch {
|
||||
Write-Error "An unexpected error occurred: $_"
|
||||
} finally {
|
||||
|
@ -435,10 +435,8 @@ $sync["ISOmanual"].add_Checked({
|
||||
$sync["ISOLanguage"].Visibility = [System.Windows.Visibility]::Collapsed
|
||||
})
|
||||
|
||||
$sync["ISORelease"].Items.Add("23H2") | Out-Null
|
||||
$sync["ISORelease"].Items.Add("22H2") | Out-Null
|
||||
$sync["ISORelease"].Items.Add("21H2") | Out-Null
|
||||
$sync["ISORelease"].SelectedItem = "23H2"
|
||||
$sync["ISORelease"].Items.Add("24H2") | Out-Null
|
||||
$sync["ISORelease"].SelectedItem = "24H2"
|
||||
|
||||
$sync["ISOLanguage"].Items.Add("System Language ($(Get-FidoLangFromCulture -langName $((Get-Culture).Name)))") | Out-Null
|
||||
if ($currentCulture -ne "English International") {
|
||||
|
@ -72,80 +72,45 @@ function Invoke-Preprocessing {
|
||||
throw "[Invoke-Preprocessing] Invalid Paramter Value for 'WorkingDir', passed value: '$WorkingDir'. Either the path is a File or Non-Existing/Invlid, please double check your code."
|
||||
}
|
||||
|
||||
$count = $ExcludedFiles.Count
|
||||
|
||||
# Make sure there's a * at the end of folders in ExcludedFiles list
|
||||
for ($i = 0; $i -lt $count; $i++) {
|
||||
$excludedFile = $ExcludedFiles[$i]
|
||||
$isFolder = ($excludedFile) -match '\\$'
|
||||
if ($isFolder) { $ExcludedFiles[$i] = $excludedFile + '*' }
|
||||
$InternalExcludedFiles = [System.Collections.Generic.List[string]]::new($ExcludedFiles.Count)
|
||||
ForEach ($excludedFile in $ExcludedFiles) {
|
||||
$InternalExcludedFiles.Add($excludedFile) | Out-Null
|
||||
}
|
||||
|
||||
# Validate the ExcludedFiles List before continuing on,
|
||||
# that's if there's a list in the first place, and '-SkipExcludedFilesValidation' was not provided.
|
||||
if (-not $SkipExcludedFilesValidation) {
|
||||
for ($i = 0; $i -lt $count; $i++) {
|
||||
$excludedFile = $ExcludedFiles[$i]
|
||||
# Validate the ExcludedItems List before continuing on,
|
||||
# that's if there's a list in the first place, and '-SkipInternalExcludedFilesValidation' was not provided.
|
||||
if ($ExcludedFiles.Count -gt 0) {
|
||||
ForEach ($excludedFile in $ExcludedFiles) {
|
||||
$filePath = "$(($WorkingDir -replace ('\\$', '')) + '\' + ($excludedFile -replace ('\.\\', '')))"
|
||||
|
||||
# Handle paths with wildcards in a different implementation
|
||||
$matches = ($filePath) -match '^.*?\*'
|
||||
|
||||
if ($matches) {
|
||||
if (-NOT (Get-ChildItem -Recurse -Path "$filePath" -File -Force)) {
|
||||
$failedFilesList += "'$filePath', "
|
||||
$files = Get-ChildItem -Recurse -Path "$filePath" -File -Force
|
||||
if ($files.Count -gt 0) {
|
||||
ForEach ($file in $files) {
|
||||
$InternalExcludedFiles.Add("$($file.FullName)") | Out-Null
|
||||
}
|
||||
} else {
|
||||
if (-NOT (Test-Path -Path "$filePath")) {
|
||||
$failedFilesList += "'$filePath', "
|
||||
}
|
||||
}
|
||||
} else { $failedFilesList += "'$filePath', " }
|
||||
}
|
||||
$failedFilesList = $failedFilesList -replace (',\s*$', '')
|
||||
if (-NOT $failedFilesList -eq "") {
|
||||
if ((-not $failedFilesList -eq "") -and (-not $SkipExcludedFilesValidation)) {
|
||||
throw "[Invoke-Preprocessing] One or more File Paths and/or File Patterns were not found, you can use '-SkipExcludedFilesValidation' switch to skip this check, the failed to validate are: $failedFilesList"
|
||||
}
|
||||
}
|
||||
|
||||
# Get Files List
|
||||
[System.Collections.ArrayList]$files = Get-ChildItem $WorkingDir -Recurse -Exclude $ExcludedFiles -File -Force
|
||||
$numOfFiles = $files.Count
|
||||
[System.Collections.ArrayList]$files = Get-ChildItem -LiteralPath $WorkingDir -Recurse -Exclude $InternalExcludedFiles -File -Force
|
||||
|
||||
# Only keep the 'FullName' Property for every entry in the list
|
||||
for ($i = 0; $i -lt $numOfFiles; $i++) {
|
||||
for ($i = 0; $i -lt $files.Count; $i++) {
|
||||
$file = $files[$i]
|
||||
$files[$i] = $file.FullName
|
||||
}
|
||||
|
||||
# If a file(s) are found in Exclude List,
|
||||
# Remove the file from files list.
|
||||
for ($j = 0; $j -lt $excludedFiles.Count; $j++) {
|
||||
# Prepare some variables
|
||||
$excluded = $excludedFiles[$j]
|
||||
$pathToFind = ($excluded) -replace ('^\.\\', '')
|
||||
$pathToFind = $WorkingDir + '\' + $pathToFind
|
||||
$index = -1 # reset index on every iteration
|
||||
|
||||
# Handle paths with wildcards in a different implementation
|
||||
$matches = ($pathToFind) -match '^.*?\*'
|
||||
|
||||
if ($matches) {
|
||||
$filesToCheck = Get-ChildItem -Recurse -Path "$pathToFind" -File -Force
|
||||
if ($filesToCheck) {
|
||||
for ($k = 0; $k -lt $filesToCheck.Count; $k++) {
|
||||
$fileToCheck = $filesToCheck[$k]
|
||||
$index = $files.IndexOf("$fileToCheck")
|
||||
if ($index -ge 0) { $files.RemoveAt($index) }
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$index = $files.IndexOf("$pathToFind")
|
||||
if ($index -ge 0) { $files.RemoveAt($index) }
|
||||
}
|
||||
ForEach ($excludedFile in $InternalExcludedFiles) {
|
||||
$index = $files.IndexOf("$excludedFile")
|
||||
if ($index -ge 0) { $files.RemoveAt($index) }
|
||||
}
|
||||
|
||||
# Make sure 'numOfFiles' is synced with the actual Number of Files found in '$files'
|
||||
# This's done because previous may or may not edit the files list, so we should update it
|
||||
$numOfFiles = $files.Count
|
||||
|
||||
if ($numOfFiles -eq 0) {
|
||||
|
@ -1029,7 +1029,7 @@
|
||||
HorizontalAlignment="Stretch">
|
||||
<StackPanel Name="MicrowinMain" Background="{DynamicResource MainBackgroundColor}" SnapsToDevicePixels="True" Grid.Column="0" Grid.Row="0">
|
||||
<StackPanel Background="Transparent" SnapsToDevicePixels="True" Margin="1">
|
||||
<CheckBox x:Name="WPFMicrowinDownloadFromGitHub" Content="Download oscdimg.exe from CTT Github repo" IsChecked="False" Margin="{DynamicResource MicrowinCheckBoxMargin}" />
|
||||
<CheckBox x:Name="WPFMicrowinDownloadFromGitHub" Content="Download oscdimg.exe from CTT Github repo" IsChecked="True" Margin="{DynamicResource MicrowinCheckBoxMargin}" />
|
||||
<TextBlock Margin="5" Padding="1" TextWrapping="Wrap" Foreground="{DynamicResource ComboBoxForegroundColor}">
|
||||
Choose a Windows ISO file that you've downloaded <LineBreak/>
|
||||
Check the status in the console
|
||||
|
Loading…
Reference in New Issue
Block a user