Compare commits

...

75 Commits

Author SHA1 Message Date
b5c80bfbd2 write info into shell for user
Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com>
2024-11-06 17:44:07 +01:00
f3bffa9952 restore usage of EditionID
TODO: fetch EditionID foreach index without looping Get-WindowsImage
2024-11-06 11:38:19 +01:00
125e78be96 refractor PR
- remove "Segoe Fluent Icons" changes
- add Invoke-WPFGetIso improvements from #2731
> read image once, then take info from the result of that.
2024-11-02 00:04:19 +01:00
affedd3cab [FEAT] change/add some icons
- change settings & close icon to new one using "Segoe Fluent Icons" fontfamily
- add icons to search context menu using "Segoe Fluent Icons" fontfamily
2024-11-01 21:18:16 +01:00
ce1ef2a519 Deploying to main from @ ChrisTitusTech/winutil@77cb0a14c4 🚀 2024-11-01 15:33:13 +00:00
77cb0a14c4 Gets docs ready for moving (#2992) 2024-10-29 17:27:31 -05:00
c254a43f77 Fix policy reset for default updates 2024-10-29 16:58:14 -05:00
640d2ca107 [MicroWin] Remove WinUtil shortcut on first logon (#2989) 2024-10-29 16:51:32 -05:00
c186642998 Remove WPFShortcut Creation
Was causing virus false positives.
2024-10-29 16:35:43 -05:00
47a4f1547e Merge branch 'main' of https://github.com/ChrisTitusTech/winutil 2024-10-29 16:22:04 -05:00
1caf3111d3 remove shortcut hexedit 2024-10-29 16:21:57 -05:00
7dcdc4dbb7 Deploying to main from @ ChrisTitusTech/winutil@bfaba14191 🚀 2024-10-26 15:31:46 +00:00
bfaba14191 [MicroWin] Fix Recall "Dependency" Misinformation (#2947)
Fixed the misinformation caused by the Recall feature. Thanks @WitherOrNot and @thecatontheceiling for spotting the problem
2024-10-24 15:45:24 -05:00
5640f9d04c Disable Recall (#2974)
Adds Tweak option to Disable MS Recall using DISM and Reg Key.
2024-10-24 15:43:33 -05:00
c6a832b006 Deploying to main from @ ChrisTitusTech/winutil@fe19094395 🚀 2024-10-24 15:33:00 +00:00
fe19094395 Deploying to main from @ ChrisTitusTech/winutil@fdd32f441f 🚀 2024-10-23 15:33:11 +00:00
fdd32f441f Deploying to main from @ ChrisTitusTech/winutil@e4565f1f6f 🚀 2024-10-16 15:33:17 +00:00
Rux
e4565f1f6f Hotfix feature.json (#2865)
- Stray comma at the end of line 324.
- Since JSON handling is different between Powershell 5 and Powershell 7. You only notice the error during Compiling on Powershell 5. Fixes https://github.com/ChrisTitusTech/winutil/issues/2864
2024-10-07 15:41:38 -05:00
1404efab26 [MicroWin] First Anniversary Special PR (#2853)
* Fix minor denomination problem for packages

* Fix incorrect filter of OS packages

Packages such as the metadata for capabilities (FoDs) or the foundation package were being incorrectly filtered. They were part of `Remove-ProvisionedPackages`, which only removes AppX packages. These are **OS packages**, something completely different

* Fixed indentation

* Exclude `Microsoft-RemoteDesktopConnection`

Exclude that from feature list. Fixes #2705

* Remove DISM from AppX removal listings

DISM is a system component. It will never be an AppX package. This is unnecessary

* Improve error handling for file copy

* Remove space (for some reason)

Compilation script is very adamant that this should be this way

* Exclude the VBSCRIPT Features on Demand from pkgs

Exclude the VBSCRIPT feature on demand (or capability) from package removal. Some people were reporting that excluding VBSCRIPT fixed problems with AMD chipset drivers on MicroWin

* Exclude Recall from feature listings

This fixes problems people were experiencing where the file explorer would go back to the Windows 10 layout

* Improve error output

* Add 24H2 to release list

* Detect Windows 10 and show compatibility dialog

* Disable some insane desktop stuff on Windows 10

I've only been able to disable Search Highlights. News and Interests persists

* Change policy for News and Interests

Avoid showing "Access denied" errors for this. This is still broken - News and Interests is still there. [louder]Linus Torvalds curse word here[/louder]

Anyway, if someone wants to give setting this up a shot, send me suggestions on how to do this

* Write suggestion for AV

* Hold errored packages in a list

Items are being added correctly, but I can't get that to show to the end-user. Perhaps a different approach will work

* Remove older Windows versions from download list

Sadly, the links for these had been removed by Microsoft, in favor of the latest version (24H2)

* Add sorting to error messages

Thanks @og-mrk for the suggestion and the patch (even though I applied it myself)

* Make error messages easier to view (#1)

* Make error messages easier to view

* Improve error output

---------

Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com>

* Disable Recall on first run

Keeps the Explorer look of modern Windows 11 builds whilst removing the Recall feature (which I think will manifest itself on PCs with Lunar Lake processors)

* Replace "C:\" with environment variable

This still works on single-boot configurations, but presents a more dynamic approach

* Fix Volume Mixer issues and removal of leftovers

Fix originally from @MyDrift-user on #2856

* Add missing piece to last commit

* Default to downloading OSCDIMG from GitHub repo

Chocolatey may not be the way to help us detect the presence of OSCDIMG.

Everyone, unless someone REALLY uses old deployment technology, has moved to Windows ADK 10.0

* Fix Sorting of Errored Packages by using 'Sort-Object' instead of 'IComparer' approach (#2)

Fixes startup issues in PWSH 7

* Remove reference to News and Interests from output

Even though the logic is still there, it doesn't work. I don't want to deal with that anymore. Search Highlights, on the other hand, is removed very easily

* Exclude License packages from removal

They throw an "Access denied" error when trying to remove them. This is a timesaver

---------

Co-authored-by: Mr.k <mineshtine28546271@gmail.com>
2024-10-07 15:37:47 -05:00
1deb863f40 Deploying to main from @ ChrisTitusTech/winutil@de73efa868 🚀 2024-10-07 15:33:02 +00:00
de73efa868 Grammar fix (#2839) 2024-10-06 13:22:40 -05:00
59097fc7e1 Deploying to main from @ ChrisTitusTech/winutil@207ce43428 🚀 2024-10-03 15:33:16 +00:00
207ce43428 Deploying to main from @ ChrisTitusTech/winutil@d92284ec83 🚀 2024-10-02 15:33:12 +00:00
Rux
d92284ec83 Use here-strings for JSON in Compile.ps1 (#2816)
* Use here-strings for JSON in Compile.ps1

- Change Compile.ps1 to use here-strings with JSON, similar to my changes to Xaml being ingested using here-strings.

* Slight changes.

- Modifications, allowing for the removal of all .replace() functions in JSON handler.
- Changed formatting of here-string on line 91 -> 89 to prevent accidental double in winutil.ps1 (Doesn't cause an issue, but looks better.)
- Added here-string to 95 -> 93 (This allowed the removal of the final .replace())

* Added comment.

- Added comment to line 90.
2024-10-01 16:10:48 -05:00
d855b08119 Add logic to remove Registry Keys via Tweaks (#2837) 2024-10-01 15:51:18 -05:00
0deac4ebb2 Remove duplicate Edge tweak (#2832) 2024-10-01 15:47:56 -05:00
c6fcf21dce Update Invoke-WinUtilMicroWin-Helper.ps1 (#2835)
added directplay to not remove on MicroWin
2024-10-01 15:43:10 -05:00
64ed00c2db Fix: Resolve ms-edge policy errors by removing invalid policies (#2820)
Removed EdgeEnhanceImagesEnabled and EdgeFollowEnabled policies, which were causing "unknown policy" errors.
2024-10-01 15:40:55 -05:00
e165388117 [IMPEX] add link support (#2815)
* rework impex

- rework impex
- add link logic

* add error handling
2024-10-01 15:23:36 -05:00
806cbd021a Fix Excluding Logic for Preprocessor (#2813)
This commit should fix issue #2795 reported by @CodingWonders
2024-10-01 15:21:49 -05:00
869071783c Add dns0.eu (#2808) 2024-10-01 15:20:17 -05:00
ae74965548 Merge branch 'main' of https://github.com/ChrisTitusTech/winutil 2024-10-01 15:12:54 -05:00
b43d31088c fix indent 2024-10-01 15:12:52 -05:00
4fa1b0ddc7 remove elevation (#2807) 2024-10-01 15:12:15 -05:00
f012064574 SSH server option (#2745)
* Squashed commit of the following:

commit c674d5eb605b549d8d8b247749954a98197277b4
Author: Saksham Singh <sakshamsingh.93502@gmail.com>
Date:   Wed Sep 11 19:34:44 2024 +0530

    desc update

commit 3d8bf2bdc9c382a9f087b9ac6e63cb8604c99698
Author: Saksham Singh <sakshamsingh.93502@gmail.com>
Date:   Wed Sep 11 19:30:23 2024 +0530

    Added Razer Block

    Added the razer block by chris titus under the Fixes Section

* Moved razer-block from features to tweaks

* Updated tweaks.json

* Added option to enable ssh server under config tab

* Revert "Added option to enable ssh server under config tab"

This reverts commit ade414284d.

* Added Option to enable ssh server under config tab

* updated docs

* Removed #2715 from this PR

* update variable name

* Fixed authorized_keys file creation issue

auth key file was not being created due to incomplete file path from the $env:HOMEPATH and also corrected the ssh directory to .ssh
2024-10-01 14:20:45 -05:00
db26666f97 Docs update (#2655)
* Add 'dev' in 'docs' Folder to the Ignored Nav List to suppress mkdocs warnings on each site build

* Move '/.github/CONTRIBUTING.md' to '/docs' folder, and removed '/docs/contribute.md' as it's not needed any more

* Add GitHub Dark & Light Themes Tagging to Images found in the Docs
2024-10-01 14:10:17 -05:00
38cf922572 Deploying to main from @ ChrisTitusTech/winutil@dd337be45e 🚀 2024-10-01 15:33:08 +00:00
dd337be45e Remove suspisous app from winutil. (#2846)
* Update close-issue-command.yaml

Co-Authored-By: Adam Perkowski <adas1per@protonmail.com>

* Update applications.json

---------

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
2024-09-30 15:00:06 -05:00
3670c78789 Deploying to main from @ ChrisTitusTech/winutil@225e774f1e 🚀 2024-09-30 15:33:36 +00:00
225e774f1e Deploying to main from @ ChrisTitusTech/winutil@0703935bfb 🚀 2024-09-26 15:33:02 +00:00
0703935bfb Formatting fixes 2024-09-23 12:55:43 -05:00
fd2ac35228 Revert "refac(invoke-wpfuninstall.ps1): remove null assignments and simplify …" (#2806)
This reverts commit f516c09ab3.
2024-09-23 12:49:01 -05:00
f516c09ab3 refac(invoke-wpfuninstall.ps1): remove null assignments and simplify taskbaritem invocation (#2797) 2024-09-23 12:42:58 -05:00
182fe09b64 Change Preset Type and Contains (#2789) 2024-09-23 12:34:45 -05:00
02751c706d Fix Dark Color Scheme (#2788)
* fixes the ComboBoxForegroundColor to be more easily readable on dark mode

* Fix Background

* Change DNS Dropdown to Button Color
2024-09-23 12:30:00 -05:00
102231c0e3 [MicroWin] ISO Downloader Enhancements (#2787)
* Avoid duplicating items in lang list and fix issue

- Changed the first item in the language list to show "System language". Then we determine it and download it
- Fixed an issue where the entire contents of `gci` were being passed to the variable, which causes the rest to fail

* Add spaces for consistent indentation

* Modify current dir command to automatic variable

Thanks  @ruxunderscore  for suggesting

* Move downloaded ISO to user-specified path

* Indentation fixes for comments

* Update functions/public/Invoke-WPFGetIso.ps1

Co-authored-by: Luka Momčilović <l.momcilovic61@gmail.com>

* Modify first language item and add error handling

---------

Co-authored-by: Luka Momčilović <l.momcilovic61@gmail.com>
2024-09-23 12:29:34 -05:00
b9d7619f9b Explicitly look for a Boolean Result (#2801) 2024-09-23 12:24:45 -05:00
4e39096b51 Deploying to main from @ ChrisTitusTech/winutil@662139ca5f 🚀 2024-09-23 15:32:23 +00:00
662139ca5f Fix prefer choco visibility (#2782) 2024-09-21 10:03:56 -05:00
42febae25e Actively follow windows theme (#2781) 2024-09-21 10:01:02 -05:00
395ac9495d Fix Variable Typo (#2780) 2024-09-21 10:00:32 -05:00
6cc7d314fe nav bar fixes (#2779) 2024-09-21 10:00:07 -05:00
ba45c3303e Microwin ISO downloader (#2581)
* try1

* little fix

* change back to using Fido

* little update

* fix some stuff

* fix (maybe?)

* remove architecture selection

* add somewhat of a lang support (needs improvement)

* WIP: refractor of existing logic & addition of language selection

* WIP: correct lang display (not working rn)

* improve, fix and more

- call ed with default windows edition (Home/Pro/Edu)
- fix language combobox logic
- add @CodingWonders 's "Get-FidoLangFromCulture"
- hide comboboxes if manual ISO selection is toggled

* little output fix

- added | Out-Null to combobox item additions to prevent unneeded console output

* improve coloring

- using ToggleButtonOnColor for Radiobuttons
- add theme color ToggleButtonOffColor and use where needed

* fix lang

* fix "en-" lang

remove (United States) bc it is wrong and not accepted by fido/ms

* always add "English"

* fix theming

- add ToggleButtonOffColor to all themes

* fix merge issue

* update instructions

* update ui

- manual download is primary option
- radiobuttons renamed to refrect what they are
- fix styling of instruction
- add margin to radiobuttons

* fix  by adding line break to instructions

* fix merge issues
2024-09-21 09:30:10 -05:00
1f683d3f78 UI fixes (#2727)
* ui fixes

- better coloring for scrollbar
- better styling for tooltip
- better styling for menuitem
- change max window size on startup to correctly display install tab

* Fix Borders of Right Click menu for Textbox (eg. Searchbar) (#9)

* sync fork & remove merge issues

* Revert "sync fork & remove merge issues"

This reverts commit dd64f06b89.

* remove unneeded code

---------

Co-authored-by: Martin Wiethan <47688561+Marterich@users.noreply.github.com>
2024-09-21 09:29:02 -05:00
18dff2af5e Update close-issue-command.yaml (#2785)
Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
2024-09-21 09:24:34 -05:00
377758758e Disable powercfg fix (#2728) 2024-09-20 09:04:26 -05:00
3f2759f967 format changes 2024-09-20 09:03:18 -05:00
1ee7274bdb add ep refresh for dark mode toggle (#2732) 2024-09-20 09:01:39 -05:00
06baebc60b Add the option to Block Razer automatic installs (#2715)
* Squashed commit of the following:

commit c674d5eb605b549d8d8b247749954a98197277b4
Author: Saksham Singh <sakshamsingh.93502@gmail.com>
Date:   Wed Sep 11 19:34:44 2024 +0530

    desc update

commit 3d8bf2bdc9c382a9f087b9ac6e63cb8604c99698
Author: Saksham Singh <sakshamsingh.93502@gmail.com>
Date:   Wed Sep 11 19:30:23 2024 +0530

    Added Razer Block

    Added the razer block by chris titus under the Fixes Section

* Moved razer-block from features to tweaks

* Updated tweaks.json

* Added option to enable ssh server under config tab

* Undoing a accidental pushed commit

* minor change
2024-09-20 08:55:17 -05:00
10917c159c refac(toggle status): simplify return statements (#2713) 2024-09-20 08:35:49 -05:00
0251757fc0 Add the option to change the UI Theme at runtime (#2693)
* Setup for testing

* Working Example for Background

* Almost all MainBackgrounColor working

* Random Color PoC

* Fix DBorderColor

* prevent old logic from replacing colors in memory at startup

* Comment out resources in xaml

* Finish new Button

* Remove Pulse, Load Windows default Theme

* Fix Colors

* Fix Toggle Colors

* working version, with shared still being mostly applied be replace instead of resouces

* Load all entries in themes.json as Resource and reference them in inputXML.xaml

* Rename File to match Function Name

* Hotfix for Sync with main

* Remove Static Set-WinUtilUITheme function/file

* Rename File and Function

* Cleanup and Stuff

* Unify Button Theme with rest of UI

* Refactor/Optimazation

* Performance optimization

* Add Comments

* Rename Functions and Variables to be more concise and descriptive

* Add persistence to the user Theme Preference across winutil restarts

* Reimplement Theme Chagnes from #2722

* Add AUTO option to follow window theme and add dropdown instead toggle

* Formatting and deleting temp file

* Fix small display bug where Dropdown would remain open for settings and themes

* Remove terniary operators because only PS7+ is supported
2024-09-20 08:34:10 -05:00
9136ed9802 Fix: Window Statechange on doubleclick works everywhere (#2768)
* Run the Doubleclick action only on Grid and Stackpanel and cleanup the logic

* Remove ternary operator because it is only supported for powershell 7+
2024-09-20 08:32:41 -05:00
b3bbe0dbe5 [MicroWin] Exclude Search Engine Package (#2761) 2024-09-20 08:31:36 -05:00
16b11e994b Deploying to main from @ ChrisTitusTech/winutil@a5a06c2a9b 🚀 2024-09-18 15:32:38 +00:00
a5a06c2a9b [MicroWin] Exclude Snip & Sketch from AppX removal (#2737) 2024-09-15 14:22:32 -05:00
81aead7a68 Update release-drafter.yml 2024-09-12 11:16:01 -05:00
a55a44a54c Color the Description in the Update tab where the text was talking the blue and didn't had it own color. Fixed some color contrast issue (#2722) 2024-09-12 09:53:43 -05:00
9c0b0b8913 format update 2024-09-12 09:49:06 -05:00
7fe0f9a163 Fix the way arguments are passed to the runspace (#2720)
* Fix the way arguments are passed to the runspace

* Add $handle return

* Fix Choco Install logic
2024-09-12 09:45:54 -05:00
8e5fcceddb fix "ToLower" method invocation failure (#2714) 2024-09-11 09:20:25 -05:00
19a3c7070a Update release-drafter.yml 2024-09-10 18:12:21 -05:00
343a72f528 Update pre-release.yaml 2024-09-10 18:02:42 -05:00
0b13ca4b11 update release 2024-09-10 18:01:18 -05:00
215de06a58 Update release-drafter.yml 2024-09-10 17:11:38 -05:00
80555d945e Update release-drafter.yml 2024-09-10 17:05:13 -05:00
44 changed files with 1675 additions and 1198 deletions

View File

@ -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
View File

@ -11,6 +11,9 @@ nav:
- Known Issues: 'KnownIssues.md' - Known Issues: 'KnownIssues.md'
- FAQ: 'faq.md' - FAQ: 'faq.md'
not_in_nav: |
dev/
theme: theme:
name: material name: material
custom_dir: '../overrides' custom_dir: '../overrides'

View File

@ -1,6 +1,4 @@
name-template: '$RESOLVED_VERSION' tag-prefix: ''
tag-template: '$RESOLVED_VERSION'
tag-prefix: ""
categories: categories:
- title: '🚀 Features' - title: '🚀 Features'
labels: labels:
@ -21,10 +19,6 @@ template: |
$CHANGES $CHANGES
## Contributors
$CONTRIBUTORS
change-title-escapes: '\<*_&"''' change-title-escapes: '\<*_&"'''
autolabeler: autolabeler:
- label: 'documentation' - label: 'documentation'
@ -56,3 +50,5 @@ replacers:
replace: '' replace: ''
exclude-labels: exclude-labels:
- 'skip-changelog' - 'skip-changelog'
filter-by-commitish: true

View File

@ -15,18 +15,33 @@ jobs:
contents: read contents: read
steps: steps:
- name: Check for /close comment - run: echo "command=false" >> $GITHUB_ENV
id: check_comment
- name: Check for /close command
id: check_close_command
run: | run: |
if [[ "${{ contains(github.event.comment.body, '/close') }}" == "true" ]]; then if [[ "${{ contains(github.event.comment.body, '/close') }}" == "true" ]]; then
echo "comment=true" >> $GITHUB_ENV echo "command=true" >> $GITHUB_ENV
echo "close_command=true" >> $GITHUB_ENV
echo "reopen_command=false" >> $GITHUB_ENV
else else
echo "comment=false" >> $GITHUB_ENV echo "close_command=false" >> $GITHUB_ENV
fi
- name: Check for /open or /reopen command
id: check_reopen_command
run: |
if [[ "${{ contains(github.event.comment.body, '/open') }}" == "true" ]] || [[ "${{ contains(github.event.comment.body, '/reopen') }}" == "true" ]]; then
echo "command=true" >> $GITHUB_ENV
echo "reopen_command=true" >> $GITHUB_ENV
echo "close_command=false" >> $GITHUB_ENV
else
echo "reopen_command=false" >> $GITHUB_ENV
fi fi
- name: Check if the user is allowed - name: Check if the user is allowed
id: check_user id: check_user
if: env.comment == 'true' if: env.command == 'true'
run: | run: |
ALLOWED_USERS=("ChrisTitusTech" "og-mrk" "Marterich" "MyDrift-user" "Real-MullaC") ALLOWED_USERS=("ChrisTitusTech" "og-mrk" "Marterich" "MyDrift-user" "Real-MullaC")
if [[ " ${ALLOWED_USERS[@]} " =~ " ${{ github.event.comment.user.login }} " ]]; then if [[ " ${ALLOWED_USERS[@]} " =~ " ${{ github.event.comment.user.login }} " ]]; then
@ -36,10 +51,23 @@ jobs:
fi fi
- name: Close issue if conditions are met - name: Close issue if conditions are met
if: env.comment == 'true' && env.user == 'true' if: env.close_command == 'true' && env.user == 'true'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }} ISSUE_NUMBER: ${{ github.event.issue.number }}
run: | run: |
echo Closing the issue... echo Closing the issue...
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }} if [[ "${{ contains(github.event.comment.body, 'not planned') }}" == "true" ]]; then
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }} --reason 'not planned'
else
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }}
fi
- name: Reopen issue if conditions are met
if: env.reopen_command == 'true' && env.user == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
echo Reopening the issue...
gh issue reopen $ISSUE_NUMBER --repo ${{ github.repository }}

View File

@ -81,14 +81,14 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
config-name: release-drafter.yml config-name: release-drafter.yml
version: ${{ env.version }} version: ${{ env.VERSION }} # Pass the version variable
- name: Create and Upload Release - name: Create and Upload Release
id: create_release id: create_release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
tag_name: ${{ env.version }} tag_name: ${{ env.VERSION }}
name: Pre-Release ${{ env.version }} name: Pre-Release ${{ env.VERSION }}
body: | body: |
${{ steps.generate_notes.outputs.body }} ${{ steps.generate_notes.outputs.body }}

View File

@ -73,8 +73,8 @@ Get-ChildItem "functions" -Recurse -File | ForEach-Object {
} }
Update-Progress "Adding: Config *.json" 40 Update-Progress "Adding: Config *.json" 40
Get-ChildItem "config" | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object { Get-ChildItem "config" | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object {
$json = (Get-Content $psitem.FullName).replace("'","''") $json = (Get-Content $psitem.FullName -Raw)
$jsonAsObject = $json | convertfrom-json $jsonAsObject = $json | ConvertFrom-Json
# Add 'WPFInstall' as a prefix to every entry-name in 'applications.json' file # Add 'WPFInstall' as a prefix to every entry-name in 'applications.json' file
if ($psitem.Name -eq "applications.json") { 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 # Line 90 requires no whitespace inside the here-strings, to keep formatting of the JSON in the final script.
# 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 = @"
$json = ($jsonAsObject | convertto-json -Depth 3).replace('\r\n',"`r`n") $($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) = '$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 # Read the entire XAML file as a single string, preserving line breaks

File diff suppressed because one or more lines are too long

View File

@ -445,7 +445,7 @@
"category": "Utilities", "category": "Utilities",
"content": "Dual Monitor Tools", "content": "Dual Monitor Tools",
"link": "https://dualmonitortool.sourceforge.net/", "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": { "duplicati": {
"category": "Utilities", "category": "Utilities",
@ -2855,14 +2855,6 @@
"link": "https://www.kicad.org/", "link": "https://www.kicad.org/",
"winget": "KiCad.KiCad" "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": { "dropox": {
"category": "Utilities", "category": "Utilities",
"choco": "na", "choco": "na",

View File

@ -46,5 +46,23 @@
"Secondary": "94.140.15.16", "Secondary": "94.140.15.16",
"Primary6": "2a10:50c0::bad1:ff", "Primary6": "2a10:50c0::bad1:ff",
"Secondary6": "2a10:50c0::bad2: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"
} }
} }

View File

@ -313,5 +313,13 @@
"Order": "a083_", "Order": "a083_",
"Type": "Button", "Type": "Button",
"ButtonWidth": "300" "ButtonWidth": "300"
},
"WPFWinUtilSSHServer": {
"Content": "Enable OpenSSH Server",
"category": "Remote Access",
"panel": "2",
"Order": "a084_",
"Type": "Button",
"ButtonWidth": "300"
} }
} }

View File

@ -1,81 +1,44 @@
{ {
"_default": { "shared":{
"CustomDialogFontSize": "12", "CustomDialogFontSize": "12",
"CustomDialogFontSizeHeader": "14", "CustomDialogFontSizeHeader": "14",
"CustomDialogIconSize": "25", "CustomDialogIconSize": "25",
"CustomDialogWidth": "400", "CustomDialogWidth": "400",
"CustomDialogHeight": "200", "CustomDialogHeight": "200",
"FontSize": "12", "FontSize": "12",
"FontFamily": "Arial", "FontFamily": "Arial",
"FontSizeHeading": "16", "FontSizeHeading": "16",
"HeaderFontFamily": "Consolas, Monaco", "HeaderFontFamily": "Consolas, Monaco",
"CheckBoxBulletDecoratorSize": "14", "CheckBoxBulletDecoratorSize": "14",
"CheckBoxMargin": "15,0,0,2", "CheckBoxMargin": "15,0,0,2",
"TabContentMargin": "5", "TabContentMargin": "5",
"TabButtonFontSize": "14", "TabButtonFontSize": "14",
"TabButtonWidth": "100", "TabButtonWidth": "110",
"TabButtonHeight": "25", "TabButtonHeight": "26",
"TabRowHeightInPixels": "50", "TabRowHeightInPixels": "50",
"IconFontSize": "14", "IconFontSize": "14",
"IconButtonSize": "35", "IconButtonSize": "35",
"SettingsIconFontSize": "18", "SettingsIconFontSize": "18",
"CloseIconFontSize": "18", "CloseIconFontSize": "18",
"MicroWinLogoSize": "10", "MicroWinLogoSize": "10",
"MicrowinCheckBoxMargin": "-10,5,0,0", "MicrowinCheckBoxMargin": "-10,5,0,0",
"ProgressBarForegroundColor": "#2e77ff",
"ProgressBarBackgroundColor": "Transparent",
"ProgressBarTextColor": "#232629",
"ComboBoxBackgroundColor": "#F7F7F7",
"LabelboxForegroundColor": "#232629",
"MainForegroundColor": "#232629",
"MainBackgroundColor": "#F7F7F7",
"LabelBackgroundColor": "#F7F7F7",
"LinkForegroundColor": "#232629",
"LinkHoverForegroundColor": "#232629",
"GroupBorderBackgroundColor": "#232629", "GroupBorderBackgroundColor": "#232629",
"ComboBoxForegroundColor": "#232629",
"ButtonFontSize": "12", "ButtonFontSize": "12",
"ButtonFontFamily": "Arial", "ButtonFontFamily": "Arial",
"ButtonWidth": "200", "ButtonWidth": "200",
"ButtonHeight": "25", "ButtonHeight": "25",
"ConfigTabButtonFontSize": "16", "ConfigTabButtonFontSize": "16",
"SearchBarWidth": "200", "SearchBarWidth": "200",
"SearchBarHeight": "25", "SearchBarHeight": "26",
"SearchBarTextBoxFontSize": "12", "SearchBarTextBoxFontSize": "12",
"SearchBarClearButtonFontSize": "14", "SearchBarClearButtonFontSize": "14",
"ButtonInstallBackgroundColor": "#F7F7F7",
"ButtonTweaksBackgroundColor": "#F7F7F7",
"ButtonConfigBackgroundColor": "#F7F7F7",
"ButtonUpdatesBackgroundColor": "#F7F7F7",
"ButtonInstallForegroundColor": "#232629",
"ButtonTweaksForegroundColor": "#232629",
"ButtonConfigForegroundColor": "#232629",
"ButtonUpdatesForegroundColor": "#232629",
"ButtonBackgroundColor": "#F5F5F5",
"ButtonBackgroundPressedColor": "#1A1A1A",
"CheckboxMouseOverColor": "#999999", "CheckboxMouseOverColor": "#999999",
"ButtonBackgroundMouseoverColor": "#C2C2C2",
"ButtonBackgroundSelectedColor": "#F0F0F0",
"ButtonForegroundColor": "#232629",
"ToggleButtonOnColor": "#2e77ff",
"ButtonBorderThickness": "1", "ButtonBorderThickness": "1",
"ButtonMargin": "1", "ButtonMargin": "1",
"ButtonCornerRadius": "2", "ButtonCornerRadius": "2"
"BorderColor": "#232629",
"BorderOpacity": "0.2",
"ShadowPulse": "Forever"
}, },
"Classic": { "Light": {
"ComboBoxForegroundColor": "#232629",
"ComboBoxBackgroundColor": "#F7F7F7", "ComboBoxBackgroundColor": "#F7F7F7",
"LabelboxForegroundColor": "#232629", "LabelboxForegroundColor": "#232629",
"MainForegroundColor": "#232629", "MainForegroundColor": "#232629",
@ -83,9 +46,13 @@
"LabelBackgroundColor": "#F7F7F7", "LabelBackgroundColor": "#F7F7F7",
"LinkForegroundColor": "#232629", "LinkForegroundColor": "#232629",
"LinkHoverForegroundColor": "#232629", "LinkHoverForegroundColor": "#232629",
"GroupBorderBackgroundColor": "#232629", "ScrollBarBackgroundColor": "#4A4D52",
"ComboBoxForegroundColor": "#232629", "ScrollBarHoverColor": "#5A5D62",
"ScrollBarDraggingColor": "#6A6D72",
"ProgressBarForegroundColor": "#2e77ff",
"ProgressBarBackgroundColor": "Transparent",
"ProgressBarTextColor": "#232629",
"ButtonInstallBackgroundColor": "#F7F7F7", "ButtonInstallBackgroundColor": "#F7F7F7",
"ButtonTweaksBackgroundColor": "#F7F7F7", "ButtonTweaksBackgroundColor": "#F7F7F7",
"ButtonConfigBackgroundColor": "#F7F7F7", "ButtonConfigBackgroundColor": "#F7F7F7",
@ -96,26 +63,31 @@
"ButtonUpdatesForegroundColor": "#232629", "ButtonUpdatesForegroundColor": "#232629",
"ButtonBackgroundColor": "#F5F5F5", "ButtonBackgroundColor": "#F5F5F5",
"ButtonBackgroundPressedColor": "#1A1A1A", "ButtonBackgroundPressedColor": "#1A1A1A",
"CheckboxMouseOverColor": "#999999",
"ButtonBackgroundMouseoverColor": "#C2C2C2", "ButtonBackgroundMouseoverColor": "#C2C2C2",
"ButtonBackgroundSelectedColor": "#F0F0F0", "ButtonBackgroundSelectedColor": "#F0F0F0",
"ButtonForegroundColor": "#232629", "ButtonForegroundColor": "#232629",
"ToggleButtonOnColor": "#2e77ff" "ToggleButtonOnColor": "#2e77ff",
"ToggleButtonOffColor": "#707070",
"BorderColor": "#232629",
"BorderOpacity": "0.2"
}, },
"Matrix": { "Dark": {
"ComboBoxBackgroundColor": "#232629", "ComboBoxForegroundColor": "#F7F7F7",
"LabelboxForegroundColor": "#81a1c1", "ComboBoxBackgroundColor": "#1E3747",
"LabelboxForegroundColor": "#0567ff",
"MainForegroundColor": "#F7F7F7", "MainForegroundColor": "#F7F7F7",
"MainBackgroundColor": "#232629", "MainBackgroundColor": "#232629",
"LabelBackgroundColor": "#232629", "LabelBackgroundColor": "#232629",
"LinkForegroundColor": "#add8e6", "LinkForegroundColor": "#add8e6",
"LinkHoverForegroundColor": "#F7F7F7", "LinkHoverForegroundColor": "#F7F7F7",
"ComboBoxForegroundColor": "#81a1c1", "ScrollBarBackgroundColor": "#2E3135",
"ScrollBarHoverColor": "#3B4252",
"ScrollBarDraggingColor": "#5E81AC",
"ProgressBarForegroundColor": "#222222", "ProgressBarForegroundColor": "#222222",
"ProgressBarBackgroundColor": "Transparent", "ProgressBarBackgroundColor": "Transparent",
"ProgressBarTextColor": "#cccccc", "ProgressBarTextColor": "#cccccc",
"ButtonInstallBackgroundColor": "#222222", "ButtonInstallBackgroundColor": "#222222",
"ButtonTweaksBackgroundColor": "#333333", "ButtonTweaksBackgroundColor": "#333333",
"ButtonConfigBackgroundColor": "#444444", "ButtonConfigBackgroundColor": "#444444",
@ -129,41 +101,9 @@
"ButtonBackgroundMouseoverColor": "#3B4252", "ButtonBackgroundMouseoverColor": "#3B4252",
"ButtonBackgroundSelectedColor": "#5E81AC", "ButtonBackgroundSelectedColor": "#5E81AC",
"ButtonForegroundColor": "#F7F7F7", "ButtonForegroundColor": "#F7F7F7",
"ToggleButtonOnColor": "#2e77ff", "ToggleButtonOnColor": "#2e77ff",
"ToggleButtonOffColor": "#707070",
"BorderColor": "#0060CC", "BorderColor": "#2F373D",
"BorderOpacity": "0.2", "BorderOpacity": "0.2"
"ShadowPulse": "0:0:3"
},
"Dark": {
"ComboBoxBackgroundColor": "#232629",
"LabelboxForegroundColor": "#81a1c1",
"MainForegroundColor": "#F7F7F7",
"MainBackgroundColor": "#232629",
"LabelBackgroundColor": "#232629",
"LinkForegroundColor": "#add8e6",
"LinkHoverForegroundColor": "#F7F7F7",
"ComboBoxForegroundColor": "#81a1c1",
"ProgressBarForegroundColor": "#222222",
"ProgressBarBackgroundColor": "Transparent",
"ProgressBarTextColor": "#cccccc",
"ButtonInstallBackgroundColor": "#222222",
"ButtonTweaksBackgroundColor": "#333333",
"ButtonConfigBackgroundColor": "#444444",
"ButtonUpdatesBackgroundColor": "#555555",
"ButtonInstallForegroundColor": "#F7F7F7",
"ButtonTweaksForegroundColor": "#F7F7F7",
"ButtonConfigForegroundColor": "#F7F7F7",
"ButtonUpdatesForegroundColor": "#F7F7F7",
"ButtonBackgroundColor": "#1E3747",
"ButtonBackgroundPressedColor": "#00CFFF",
"ButtonBackgroundMouseoverColor": "#5E81AC",
"ButtonBackgroundSelectedColor": "#5E81AC",
"ButtonForegroundColor": "#F7F7F7",
"ToggleButtonOnColor": "#2e77ff",
"BorderColor": "#0b1215"
} }
} }

View File

@ -1600,13 +1600,6 @@
"Value": "0", "Value": "0",
"OriginalValue": "1" "OriginalValue": "1"
}, },
{
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
"Name": "EdgeEnhanceImagesEnabled",
"Type": "DWord",
"Value": "0",
"OriginalValue": "1"
},
{ {
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
"Name": "PersonalizationReportingEnabled", "Name": "PersonalizationReportingEnabled",
@ -1656,13 +1649,6 @@
"Value": "0", "Value": "0",
"OriginalValue": "1" "OriginalValue": "1"
}, },
{
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
"Name": "EdgeFollowEnabled",
"Type": "DWord",
"Value": "0",
"OriginalValue": "1"
},
{ {
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
"Name": "EdgeShoppingAssistantEnabled", "Name": "EdgeShoppingAssistantEnabled",
@ -1726,13 +1712,6 @@
"Value": "0", "Value": "0",
"OriginalValue": "1" "OriginalValue": "1"
}, },
{
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
"Name": "ConfigureDoNotTrack",
"Type": "DWord",
"Value": "1",
"OriginalValue": "0"
},
{ {
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
"Name": "WalletDonationEnabled", "Name": "WalletDonationEnabled",
@ -2430,12 +2409,6 @@
"Order": "a001_", "Order": "a001_",
"InvokeScript": [ "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 # Check if System Restore is enabled for the main drive
try { try {
# Try getting restore points to check if System Restore is enabled # Try getting restore points to check if System Restore is enabled
@ -2611,6 +2584,36 @@
], ],
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveCopilot" "link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveCopilot"
}, },
"WPFTweaksRecallOff": {
"Content": "Disable Recall",
"Description": "Turn Recall off",
"category": "Essential Tweaks",
"panel": "1",
"Order": "a011_",
"registry": [
{
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsAI",
"Name": "DisableAIDataAnalysis",
"Type": "DWord",
"Value": "1",
"OriginalValue": "0"
}
],
"InvokeScript": [
"
Write-Host \"Disable Recall\"
DISM /Online /Disable-Feature /FeatureName:Recall
"
],
"UndoScript": [
"
Write-Host \"Enable Recall\"
DISM /Online /Enable-Feature /FeatureName:Recall
"
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/DisableRecall"
},
"WPFTweaksDisableLMS1": { "WPFTweaksDisableLMS1": {
"Content": "Disable Intel MM (vPro LMS)", "Content": "Disable Intel MM (vPro LMS)",
"Description": "Intel LMS service is always listening on all ports and could be a huge security risk. There is no need to run LMS on home machines and even in the Enterprise there are better solutions.", "Description": "Intel LMS service is always listening on all ports and could be a huge security risk. There is no need to run LMS on home machines and even in the Enterprise there are better solutions.",
@ -2690,72 +2693,72 @@
} }
# Check if OneDrive got Uninstalled # Check if OneDrive got Uninstalled
if (-not (Test-Path $regPath)) { if (-not (Test-Path $regPath)) {
Write-Host \"Copy downloaded Files from the OneDrive Folder to Root UserProfile\" 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 Start-Process -FilePath powershell -ArgumentList \"robocopy '$($OneDrivePath)' '$($env:USERPROFILE.TrimEnd())\\' /mov /e /xj\" -NoNewWindow -Wait
Write-Host \"Removing OneDrive leftovers\" Write-Host \"Removing OneDrive leftovers\"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\Microsoft\\OneDrive\" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\Microsoft\\OneDrive\"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\OneDrive\" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:localappdata\\OneDrive\"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:programdata\\Microsoft OneDrive\" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:programdata\\Microsoft OneDrive\"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:systemdrive\\OneDriveTemp\" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$env:systemdrive\\OneDriveTemp\"
reg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\OneDrive\" -f reg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\OneDrive\" -f
# check if directory is empty before removing: # check if directory is empty before removing:
If ((Get-ChildItem \"$OneDrivePath\" -Recurse | Measure-Object).Count -eq 0) { If ((Get-ChildItem \"$OneDrivePath\" -Recurse | Measure-Object).Count -eq 0) {
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$OneDrivePath\" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue \"$OneDrivePath\"
} }
Write-Host \"Remove Onedrive from explorer sidebar\" 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:\\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 Set-ItemProperty -Path \"HKCR:\\Wow6432Node\\CLSID\\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\" -Name \"System.IsPinnedToNameSpaceTree\" -Value 0
Write-Host \"Removing run hook for new users\" Write-Host \"Removing run hook for new users\"
reg load \"hku\\Default\" \"C:\\Users\\Default\\NTUSER.DAT\" reg load \"hku\\Default\" \"C:\\Users\\Default\\NTUSER.DAT\"
reg delete \"HKEY_USERS\\Default\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDriveSetup\" /f reg delete \"HKEY_USERS\\Default\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDriveSetup\" /f
reg unload \"hku\\Default\" reg unload \"hku\\Default\"
Write-Host \"Removing autostart key\" Write-Host \"Removing autostart key\"
reg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDrive\" /f reg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDrive\" /f
Write-Host \"Removing startmenu entry\" Write-Host \"Removing startmenu entry\"
Remove-Item -Force -ErrorAction SilentlyContinue \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\OneDrive.lnk\" Remove-Item -Force -ErrorAction SilentlyContinue \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\OneDrive.lnk\"
Write-Host \"Removing scheduled task\" Write-Host \"Removing scheduled task\"
Get-ScheduledTask -TaskPath '\\' -TaskName 'OneDrive*' -ea SilentlyContinue | Unregister-ScheduledTask -Confirm:$false Get-ScheduledTask -TaskPath '\\' -TaskName 'OneDrive*' -ea SilentlyContinue | Unregister-ScheduledTask -Confirm:$false
# Add Shell folders restoring default locations # Add Shell folders restoring default locations
Write-Host \"Shell Fixing\" 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 \"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 \"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 \"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 \"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 \"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 \"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 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 \"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 \"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 \"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 \"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 \"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 \"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 \"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 \"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 \"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 \"{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 \"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 \"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 \"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 \"{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 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\" Write-Host \"Restarting explorer\"
taskkill.exe /F /IM \"explorer.exe\" taskkill.exe /F /IM \"explorer.exe\"
Start-Process \"explorer.exe\" Start-Process \"explorer.exe\"
Write-Host \"Waiting for explorer to complete loading\" 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 \"Please Note - The OneDrive folder at $OneDrivePath may still have items in it. You must manually delete it, but all the files should already be copied to the base user folder.\"
Write-Host \"If there are Files missing afterwards, please Login to Onedrive.com and Download them manually\" -ForegroundColor Yellow Write-Host \"If there are Files missing afterwards, please Login to Onedrive.com and Download them manually\" -ForegroundColor Yellow
Start-Sleep 5 Start-Sleep 5
} else { } else {
Write-Host \"Something went Wrong during the Unistallation of OneDrive\" -ForegroundColor Red Write-Host \"Something went Wrong during the Unistallation of OneDrive\" -ForegroundColor Red
} }
" "
], ],
@ -2767,6 +2770,48 @@
], ],
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveOnedrive" "link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveOnedrive"
}, },
"WPFTweaksRazerBlock": {
"Content": "Block Razer Software Installs",
"Description": "Blocks ALL Razer Software installations. The hardware works fine without any software.",
"category": "z__Advanced Tweaks - CAUTION",
"panel": "1",
"Order": "a031_",
"registry": [
{
"Path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\DriverSearching",
"Name": "SearchOrderConfig",
"Value": "0",
"OriginalValue": "1",
"Type": "DWord"
},
{
"Path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Device Installer",
"Name": "DisableCoInstallers",
"Value": "1",
"OriginalValue": "0",
"Type": "DWord"
}
],
"InvokeScript": [
"
$RazerPath = \"C:\\Windows\\Installer\\Razer\"
Remove-Item $RazerPath -Recurse -Force
New-Item -Path \"C:\\Windows\\Installer\\\" -Name \"Razer\" -ItemType \"directory\"
$Acl = Get-Acl $RazerPath
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule(\"NT AUTHORITY\\SYSTEM\",\"Write\",\"ContainerInherit,ObjectInherit\",\"None\",\"Deny\")
$Acl.SetAccessRule($Ar)
Set-Acl $RazerPath $Acl
"
],
"UndoScript": [
"
$RazerPath = \"C:\\Windows\\Installer\\Razer\"
Remove-Item $RazerPath -Recurse -Force
New-Item -Path \"C:\\Windows\\Installer\\\" -Name \"Razer\" -ItemType \"directory\"
"
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/RazerBlock"
},
"WPFTweaksDisableNotifications": { "WPFTweaksDisableNotifications": {
"Content": "Disable Notification Tray/Calendar", "Content": "Disable Notification Tray/Calendar",
"Description": "Disables all Notifications INCLUDING Calendar", "Description": "Disables all Notifications INCLUDING Calendar",
@ -3399,7 +3444,7 @@
"panel": "1", "panel": "1",
"Order": "a040_", "Order": "a040_",
"Type": "Combobox", "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" "link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/changedns"
}, },
"WPFAddUltPerf": { "WPFAddUltPerf": {
@ -3419,14 +3464,5 @@
"Type": "Button", "Type": "Button",
"ButtonWidth": "300", "ButtonWidth": "300",
"link": "https://christitustech.github.io/winutil/dev/tweaks/Performance-Plans/RemoveUltPerf" "link": "https://christitustech.github.io/winutil/dev/tweaks/Performance-Plans/RemoveUltPerf"
},
"WPFWinUtilShortcut": {
"Content": "Create WinUtil Shortcut",
"category": "Shortcuts",
"panel": "2",
"Order": "a082_",
"Type": "Button",
"ButtonWidth": "300",
"link": "https://christitustech.github.io/winutil/dev/tweaks/Shortcuts/Shortcut"
} }
} }

View File

@ -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.

View File

@ -0,0 +1,91 @@
# Disable Microsoft Recall
Last Updated: 2024-10-24
!!! info
The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
## Description
Disables MS Recall built into Windows since 24H2.
<!-- BEGIN CUSTOM CONTENT -->
<!-- END CUSTOM CONTENT -->
<details>
<summary>Preview Code</summary>
```json
"WPFTweaksRecallOff": {
"Content": "Disable Recall",
"Description": "Turn Recall off",
"category": "Essential Tweaks",
"panel": "1",
"Order": "a011_",
"registry": [
{
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsAI",
"Name": "DisableAIDataAnalysis",
"Type": "DWord",
"Value": "1",
"OriginalValue": "0"
}
],
"InvokeScript": [
"
Write-Host \"Disable Recall\"
DISM /Online /Disable-Feature /FeatureName:Recall
"
],
"UndoScript": [
"
Write-Host \"Enable Recall\"
DISM /Online /Enable-Feature /FeatureName:Recall
"
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/DisableRecall"
},
```
</details>
## Invoke Script
```powershell
Write-Host "Disable Recall"
DISM /Online /Disable-Feature /FeatureName:Recall
```
## Undo Script
```powershell
Write-Host "Enable Recall"
DISM /Online /Enable-Feature /FeatureName:Recall
```
## Registry Changes
Applications and System Components store and retrieve configuration data to modify windows settings, so we can use the registry to change many settings in one place.
You can find information about the registry on [Wikipedia](https://www.wikiwand.com/en/Windows_Registry) and [Microsoft's Website](https://learn.microsoft.com/en-us/windows/win32/sysinfo/registry).
### Registry Key: DisableAIDataAnalysis
**Type:** DWord
**Original Value:** 0
**New Value:** 1
<!-- BEGIN SECOND CUSTOM CONTENT -->
<!-- END SECOND CUSTOM CONTENT -->
[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/config/tweaks.json)

View File

@ -1,113 +0,0 @@
# Create WinUtil Shortcut
Last Updated: 2024-08-07
!!! info
The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
<!-- BEGIN CUSTOM CONTENT -->
<!-- END CUSTOM CONTENT -->
<details>
<summary>Preview Code</summary>
```json
{
"Content": "Create WinUtil Shortcut",
"category": "Shortcuts",
"panel": "2",
"Order": "a082_",
"Type": "Button",
"ButtonWidth": "300",
"link": "https://christitustech.github.io/winutil/dev/tweaks/Shortcuts/Shortcut"
}
```
</details>
## Function: Invoke-WPFShortcut
```powershell
function Invoke-WPFShortcut {
<#
.SYNOPSIS
Creates a shortcut and prompts for a save location
.PARAMETER ShortcutToAdd
The name of the shortcut to add
.PARAMETER RunAsAdmin
A boolean value to make 'Run as administrator' property on (true) or off (false), defaults to off
#>
param(
$ShortcutToAdd,
[bool]$RunAsAdmin = $false
)
# Preper the Shortcut Fields and add an a Custom Icon if it's available, else don't add a Custom Icon.
Switch ($ShortcutToAdd) {
"WinUtil" {
# Use Powershell 7 if installed and fallback to PS5 if not
if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
$shell = "pwsh.exe"
} else {
$shell = "powershell.exe"
}
$shellArgs = "-ExecutionPolicy Bypass -Command `"Start-Process $shell -verb runas -ArgumentList `'-Command `"irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1 | iex`"`'"
$DestinationName = "WinUtil.lnk"
}
}
# Show a File Dialog Browser, to let the User choose the Name and Location of where to save the Shortcut
$FileBrowser = New-Object System.Windows.Forms.SaveFileDialog
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
$FileBrowser.Filter = "Shortcut Files (*.lnk)|*.lnk"
$FileBrowser.FileName = $DestinationName
# Do an Early Return if the Save Operation was canceled by User's Input.
$FileBrowserResult = $FileBrowser.ShowDialog()
$DialogResultEnum = New-Object System.Windows.Forms.DialogResult
if (-not ($FileBrowserResult -eq $DialogResultEnum::OK)) {
return
}
# Prepare the Shortcut paramter
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName)
$Shortcut.TargetPath = $shell
$Shortcut.Arguments = $shellArgs
if (Test-Path -Path $winutildir["logo.ico"]) {
$shortcut.IconLocation = $winutildir["logo.ico"]
}
# Save the Shortcut to disk
$Shortcut.Save()
if ($RunAsAdmin -eq $true) {
$bytes = [System.IO.File]::ReadAllBytes($FileBrowser.FileName)
# Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex
$bytes[0x15] = $bytes[0x15] -bor 0x20
[System.IO.File]::WriteAllBytes($FileBrowser.FileName, $bytes)
}
Write-Host "Shortcut for $ShortcutToAdd has been saved to $($FileBrowser.FileName) with 'Run as administrator' set to $RunAsAdmin"
}
```
<!-- BEGIN SECOND CUSTOM CONTENT -->
<!-- END SECOND CUSTOM CONTENT -->
[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/config/tweaks.json)

View File

@ -34,8 +34,9 @@
* By default Winutil will use winget to install/upgrade/remove packages and fallback to Chocolatey. This option reverses the preference. * 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 * 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-Dark.png#only-dark#gh-dark-mode-only)
![Install Image](assets/Install-Tab-Light.png#only-light) ![Install Image](assets/Install-Tab-Light.png#only-light#gh-light-mode-only)
!!! tip !!! tip
If you have trouble finding an application, press `ctrl + f` and search the name of it. Applications will filter depending on your input. 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
--- ---
![Tweaks Image](assets/Tweaks-Tab-Dark.png#only-dark) ![Tweaks Image](assets/Tweaks-Tab-Dark.png#only-dark#gh-dark-mode-only)
![Tweaks Image](assets/Tweaks-Tab-Light.png#only-light) ![Tweaks Image](assets/Tweaks-Tab-Light.png#only-light#gh-light-mode-only)
### Run Tweaks ### Run Tweaks
* **Open Tweaks Tab**: Navigate to the 'Tweaks' tab in the application. * **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 * System Properties
* User Accounts * User Accounts
### Remote Access
Enables OpenSSH server on your windows machine.
## Updates ## 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** 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-Dark.png#only-dark#gh-dark-mode-only)
![Microwin](assets/Microwin-Light.png#only-light) ![Microwin](assets/Microwin-Light.png#only-light#gh-light-mode-only)
#### Basic usage #### 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 * 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. * 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-Dark.png#only-dark#gh-dark-mode-only)
![GetInstalled](assets/Get-Installed-Light.png#only-light) ![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. * 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-Dark.png#only-dark#gh-dark-mode-only)
![SettingsExport](assets/Settings-Export-Light.png#only-light) ![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. * Copy this file to a USB or somewhere you can use it after Windows installation.

View File

@ -19,10 +19,10 @@ function Copy-Files {
try { try {
$files = Get-ChildItem -Path $path -Recurse:$recurse $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) { 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) Write-Progress -Activity "Copy Windows files" -Status $status -PercentComplete ($counter++/$files.count*100)
$restpath = $file.FullName -Replace $path, '' $restpath = $file.FullName -Replace $path, ''
@ -37,7 +37,11 @@ function Copy-Files {
} }
Write-Progress -Activity "Copy Windows files" -Status "Ready" -Completed Write-Progress -Activity "Copy Windows files" -Status "Ready" -Completed
} catch { } catch {
Write-Warning "Unable to Copy all the files due to unhandled exception" Write-Host "Unable to Copy all the files due to an unhandled exception" -ForegroundColor Yellow
Write-Warning $psitem.Exception.StackTrace 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"
} }
} }

View File

@ -16,136 +16,72 @@ Function Get-WinUtilToggleStatus {
if($ToggleSwitch -eq "WPFToggleDarkMode") { if($ToggleSwitch -eq "WPFToggleDarkMode") {
$app = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').AppsUseLightTheme $app = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').AppsUseLightTheme
$system = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').SystemUsesLightTheme $system = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').SystemUsesLightTheme
if($app -eq 0 -and $system -eq 0) { return $app -eq 0 -and $system -eq 0
return $true
} else {
return $false
}
} }
if($ToggleSwitch -eq "WPFToggleBingSearch") { if($ToggleSwitch -eq "WPFToggleBingSearch") {
$bingsearch = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search').BingSearchEnabled $bingsearch = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search').BingSearchEnabled
if($bingsearch -eq 0) { return $bingsearch -ne 0
return $false
} else {
return $true
}
} }
if($ToggleSwitch -eq "WPFToggleNumLock") { if($ToggleSwitch -eq "WPFToggleNumLock") {
$numlockvalue = (Get-ItemProperty -path 'HKCU:\Control Panel\Keyboard').InitialKeyboardIndicators $numlockvalue = (Get-ItemProperty -path 'HKCU:\Control Panel\Keyboard').InitialKeyboardIndicators
if($numlockvalue -eq 2) { return $numlockvalue -eq 2
return $true
} else {
return $false
}
} }
if($ToggleSwitch -eq "WPFToggleVerboseLogon") { if($ToggleSwitch -eq "WPFToggleVerboseLogon") {
$VerboseStatusvalue = (Get-ItemProperty -path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System').VerboseStatus $VerboseStatusvalue = (Get-ItemProperty -path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System').VerboseStatus
if($VerboseStatusvalue -eq 1) { return $VerboseStatusvalue -eq 1
return $true
} else {
return $false
}
} }
if($ToggleSwitch -eq "WPFToggleShowExt") { if($ToggleSwitch -eq "WPFToggleShowExt") {
$hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt $hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt
if($hideextvalue -eq 0) { return $hideextvalue -eq 0
return $true
} else {
return $false
}
} }
if($ToggleSwitch -eq "WPFToggleSnapWindow") { if($ToggleSwitch -eq "WPFToggleSnapWindow") {
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive $hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
if($hidesnap -eq 0) { return $hidesnap -ne 0
return $false
} else {
return $true
}
} }
if($ToggleSwitch -eq "WPFToggleSnapFlyout") { if($ToggleSwitch -eq "WPFToggleSnapFlyout") {
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout $hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout
if($hidesnap -eq 0) { return $hidesnap -ne 0
return $false
} else {
return $true
}
} }
if($ToggleSwitch -eq "WPFToggleSnapSuggestion") { if($ToggleSwitch -eq "WPFToggleSnapSuggestion") {
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist $hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
if($hidesnap -eq 0) { return $hidesnap -ne 0
return $false
} else {
return $true
}
} }
if($ToggleSwitch -eq "WPFToggleMouseAcceleration") { if($ToggleSwitch -eq "WPFToggleMouseAcceleration") {
$MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed $MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed
$MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1 $MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1
$MouseThreshold2 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold2 $MouseThreshold2 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold2
if($MouseSpeed -eq 1 -and $MouseThreshold1 -eq 6 -and $MouseThreshold2 -eq 10) { return $MouseSpeed -eq 1 -and $MouseThreshold1 -eq 6 -and $MouseThreshold2 -eq 10
return $true
} else {
return $false
}
} }
if($ToggleSwitch -eq "WPFToggleTaskbarSearch") { if($ToggleSwitch -eq "WPFToggleTaskbarSearch") {
$SearchButton = (Get-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search").SearchboxTaskbarMode $SearchButton = (Get-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search").SearchboxTaskbarMode
if($SearchButton -eq 0) { return $SearchButton -ne 0
return $false
} else {
return $true
}
} }
if ($ToggleSwitch -eq "WPFToggleStickyKeys") { if ($ToggleSwitch -eq "WPFToggleStickyKeys") {
$StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags $StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags
if($StickyKeys -eq 58) { return $StickyKeys -ne 58
return $false
} else {
return $true
}
} }
if ($ToggleSwitch -eq "WPFToggleTaskView") { if ($ToggleSwitch -eq "WPFToggleTaskView") {
$TaskView = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').ShowTaskViewButton $TaskView = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').ShowTaskViewButton
if($TaskView -eq 0) { return $TaskView -ne 0
return $false
} else {
return $true
}
} }
if ($ToggleSwitch -eq "WPFToggleHiddenFiles") { if ($ToggleSwitch -eq "WPFToggleHiddenFiles") {
$HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden $HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden
if($HiddenFiles -eq 0) { return $HiddenFiles -ne 0
return $false
} else {
return $true
}
} }
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") { if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa $TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
if($TaskbarWidgets -eq 0) { return $TaskbarWidgets -ne 0
return $false
} else {
return $true
}
} }
if ($ToggleSwitch -eq "WPFToggleTaskbarAlignment") { if ($ToggleSwitch -eq "WPFToggleTaskbarAlignment") {
$TaskbarAlignment = (Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskbarAl $TaskbarAlignment = (Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskbarAl
if($TaskbarAlignment -eq 0) { return $TaskbarAlignment -ne 0
return $false
} else {
return $true
}
} }
if ($ToggleSwitch -eq "WPFToggleDetailedBSoD") { if ($ToggleSwitch -eq "WPFToggleDetailedBSoD") {
$DetailedBSoD1 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisplayParameters $DetailedBSoD1 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisplayParameters
$DetailedBSoD2 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisableEmoticon $DetailedBSoD2 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisableEmoticon
if (($DetailedBSoD1 -eq 0) -or ($DetailedBSoD2 -eq 0) -or !$DetailedBSoD1 -or !$DetailedBSoD2) { return !(($DetailedBSoD1 -eq 0) -or ($DetailedBSoD2 -eq 0) -or !$DetailedBSoD1 -or !$DetailedBSoD2)
return $false
} else {
return $true
}
} }
} }

View File

@ -13,10 +13,11 @@ function Install-WinUtilChoco {
if((Test-WinUtilPackageManager -choco) -eq "installed") { if((Test-WinUtilPackageManager -choco) -eq "installed") {
return return
} }
# Install logic taken from https://chocolatey.org/install#individual
Write-Host "Seems Chocolatey is not installed, installing now." Write-Host "Seems Chocolatey is not installed, installing now."
Start-Process -FilePath "powershell" -ArgumentList "Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop" -Wait -NoNewWindow Set-ExecutionPolicy Bypass -Scope Process -Force;
Start-Process -FilePath "powershell" -ArgumentList "choco feature enable -n allowGlobalConfirmation" -Wait -NoNewWindow [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
} catch { } catch {
Write-Host "===========================================" -Foregroundcolor Red Write-Host "===========================================" -Foregroundcolor Red

View File

@ -21,6 +21,11 @@ Function Invoke-WinUtilDarkMode {
$Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" $Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
Set-ItemProperty -Path $Path -Name AppsUseLightTheme -Value $DarkMoveValue Set-ItemProperty -Path $Path -Name AppsUseLightTheme -Value $DarkMoveValue
Set-ItemProperty -Path $Path -Name SystemUsesLightTheme -Value $DarkMoveValue Set-ItemProperty -Path $Path -Name SystemUsesLightTheme -Value $DarkMoveValue
Invoke-WinUtilExplorerRefresh
# Update Winutil Theme if the Theme Button shows the Icon for Auto
if ($sync.ThemeButton.Content -eq [char]0xF08C) {
Invoke-WinutilThemeChange -theme "Auto"
}
} catch [System.Security.SecurityException] { } catch [System.Security.SecurityException] {
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception" Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
} catch [System.Management.Automation.ItemNotFoundException] { } catch [System.Management.Automation.ItemNotFoundException] {

View File

@ -0,0 +1,33 @@
function Invoke-WinUtilExplorerRefresh {
<#
.SYNOPSIS
Refreshes the Windows Explorer
#>
Invoke-WPFRunspace -DebugPreference $DebugPreference -ScriptBlock {
# Send the WM_SETTINGCHANGE message to all windows
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class Win32 {
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
public static extern IntPtr SendMessageTimeout(
IntPtr hWnd,
uint Msg,
IntPtr wParam,
string lParam,
uint fuFlags,
uint uTimeout,
out IntPtr lpdwResult);
}
"@
$HWND_BROADCAST = [IntPtr]0xffff
$WM_SETTINGCHANGE = 0x1A
$SMTO_ABORTIFHUNG = 0x2
$timeout = 100
# Send the broadcast message to all windows
[Win32]::SendMessageTimeout($HWND_BROADCAST, $WM_SETTINGCHANGE, [IntPtr]::Zero, "ImmersiveColorSet", $SMTO_ABORTIFHUNG, $timeout, [ref]([IntPtr]::Zero))
}
}

View File

@ -25,6 +25,67 @@ 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 (
[Parameter(Mandatory, Position = 0)] [string]$langName
)
switch -Wildcard ($langName)
{
"ar*" { return "Arabic" }
"pt-BR" { return "Brazilian Portuguese" }
"bg*" { return "Bulgarian" }
{($_ -eq "zh-CH") -or ($_ -like "zh-Hans*") -or ($_ -eq "zh-SG") -or ($_ -eq "zh-CHS")} { return "Chinese (Simplified)" }
{($_ -eq "zh") -or ($_ -eq "zh-Hant") -or ($_ -eq "zh-HK") -or ($_ -eq "zh-MO") -or ($_ -eq "zh-TW") -or ($_ -eq "zh-CHT")} { return "Chinese (Traditional)" }
"hr*" { return "Croatian" }
"cs*" { return "Czech" }
"da*" { return "Danish" }
"nl*" { return "Dutch" }
"en-US" { return "English" }
{($_ -like "en*") -and ($_ -ne "en-US")} { return "English International" }
"et*" { return "Estonian" }
"fi*" { return "Finnish" }
{($_ -like "fr*") -and ($_ -ne "fr-CA")} { return "French" }
"fr-CA" { return "French Canadian" }
"de*" { return "German" }
"el*" { return "Greek" }
"he*" { return "Hebrew" }
"hu*" { return "Hungarian" }
"it*" { return "Italian" }
"ja*" { return "Japanese" }
"ko*" { return "Korean" }
"lv*" { return "Latvian" }
"lt*" { return "Lituanian" }
"nb*" { return "Norwegian" }
"pl*" { return "Polish" }
{($_ -like "pt*") -and ($_ -ne "pt-BR")} { return "Portuguese" }
"ro*" { return "Romanian" }
"ru*" { return "Russian" }
"sr-Latn*" { return "Serbian Latin" }
"sk*" { return "Slovak" }
"sl*" { return "Slovenian" }
{($_ -like "es*") -and ($_ -ne "es-MX")} { return "Spanish" }
"es-MX" { return "Spanish (Mexico)" }
"sv*" { return "Swedish" }
"th*" { return "Thai" }
"tr*" { return "Turkish" }
"uk*" { return "Ukrainian" }
default { return "English" }
}
}
function Remove-Features() { function Remove-Features() {
<# <#
.SYNOPSIS .SYNOPSIS
@ -47,6 +108,8 @@ function Remove-Features() {
$_.FeatureName -NotLike "*NetFx*" -AND $_.FeatureName -NotLike "*NetFx*" -AND
$_.FeatureName -NotLike "*Media*" -AND $_.FeatureName -NotLike "*Media*" -AND
$_.FeatureName -NotLike "*NFS*" -AND $_.FeatureName -NotLike "*NFS*" -AND
$_.FeatureName -NotLike "*SearchEngine*" -AND
$_.FeatureName -NotLike "*RemoteDesktop*" -AND
$_.State -ne "Disabled" $_.State -ne "Disabled"
} }
@ -94,6 +157,7 @@ function Remove-Packages {
$_ -NotLike "*ParentalControls*" -AND $_ -NotLike "*ParentalControls*" -AND
$_ -NotLike "*Win32WebViewHost*" -AND $_ -NotLike "*Win32WebViewHost*" -AND
$_ -NotLike "*InputApp*" -AND $_ -NotLike "*InputApp*" -AND
$_ -NotLike "*DirectPlay*" -AND
$_ -NotLike "*AccountsControl*" -AND $_ -NotLike "*AccountsControl*" -AND
$_ -NotLike "*AsyncTextService*" -AND $_ -NotLike "*AsyncTextService*" -AND
$_ -NotLike "*CapturePicker*" -AND $_ -NotLike "*CapturePicker*" -AND
@ -105,27 +169,54 @@ function Remove-Packages {
$_ -NotLike "*WMIC*" -AND $_ -NotLike "*WMIC*" -AND
$_ -NotLike "*UI.XaML*" -AND $_ -NotLike "*UI.XaML*" -AND
$_ -NotLike "*Ethernet*" -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 $failedCount = 0
$erroredPackages = [System.Collections.Generic.List[ErroredPackage]]::new()
foreach ($pkg in $pkglist) { foreach ($pkg in $pkglist) {
try { try {
$status = "Removing $pkg" $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 Remove-WindowsPackage -Path "$scratchDir" -PackageName $pkg -NoRestart -ErrorAction SilentlyContinue
} catch { } catch {
# This can happen if the package that is being removed is a permanent one, like FodMetadata # This can happen if the package that is being removed is a permanent one
Write-Host "Could not remove OS package $($pkg)" $erroredPackages.Add([ErroredPackage]::new($pkg, $_.Exception.Message))
$failedCount += 1 $failedCount += 1
continue continue
} }
} }
Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed Write-Progress -Activity "Removing Packages" -Status "Ready" -Completed
if ($failedCount -gt 0) 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 { } catch {
Write-Host "Unable to get information about the packages. MicroWin processing will continue, but packages will not be processed" Write-Host "Unable to get information about the packages. MicroWin processing will continue, but packages will not be processed"
@ -149,13 +240,8 @@ function Remove-ProvisionedPackages() {
$appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object { $appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object {
$_.PackageName -NotLike "*AppInstaller*" -AND $_.PackageName -NotLike "*AppInstaller*" -AND
$_.PackageName -NotLike "*Store*" -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 "*Notepad*" -and
$_.PackageName -NotLike "*Printing*" -and $_.PackageName -NotLike "*Printing*" -and
$_.PackageName -NotLike "*Foundation*" -and
$_.PackageName -NotLike "*YourPhone*" -and $_.PackageName -NotLike "*YourPhone*" -and
$_.PackageName -NotLike "*Xbox*" -and $_.PackageName -NotLike "*Xbox*" -and
$_.PackageName -NotLike "*WindowsTerminal*" -and $_.PackageName -NotLike "*WindowsTerminal*" -and
@ -165,7 +251,8 @@ function Remove-ProvisionedPackages() {
$_.PackageName -NotLike "*Paint*" -and $_.PackageName -NotLike "*Paint*" -and
$_.PackageName -NotLike "*Gaming*" -and $_.PackageName -NotLike "*Gaming*" -and
$_.PackageName -NotLike "*Extension*" -and $_.PackageName -NotLike "*Extension*" -and
$_.PackageName -NotLike "*SecHealthUI*" $_.PackageName -NotLike "*SecHealthUI*" -and
$_.PackageName -NotLike "*ScreenSketch*"
} }
$counter = 0 $counter = 0
@ -189,6 +276,31 @@ function Remove-ProvisionedPackages() {
} }
} }
function Get-LocalizedUsers
{
<#
.SYNOPSIS
Gets a localized user group representation for ICACLS commands (Port from DISMTools PE Helper)
.PARAMETER admins
Determines whether to get a localized user group representation for the Administrators user group
.OUTPUTS
A string containing the localized user group
.EXAMPLE
Get-LocalizedUsers -admins $true
#>
param (
[Parameter(Mandatory = $true, Position = 0)] [bool]$admins
)
if ($admins)
{
return (Get-LocalGroup | Where-Object { $_.SID.Value -like "S-1-5-32-544" }).Name
}
else
{
return (Get-LocalGroup | Where-Object { $_.SID.Value -like "S-1-5-32-545" }).Name
}
}
function Copy-ToUSB([string]$fileToCopy) { function Copy-ToUSB([string]$fileToCopy) {
foreach ($volume in Get-Volume) { foreach ($volume in Get-Volume) {
if ($volume -and $volume.FileSystemLabel -ieq "ventoy") { if ($volume -and $volume.FileSystemLabel -ieq "ventoy") {
@ -572,70 +684,70 @@ function New-CheckInstall {
# using here string to embedd firstrun # using here string to embedd firstrun
$checkInstall = @' $checkInstall = @'
@echo off @echo off
if exist "C:\windows\cpu.txt" ( if exist "%HOMEDRIVE%\windows\cpu.txt" (
echo C:\windows\cpu.txt exists echo %HOMEDRIVE%\windows\cpu.txt exists
) else ( ) else (
echo C:\windows\cpu.txt does not exist echo %HOMEDRIVE%\windows\cpu.txt does not exist
) )
if exist "C:\windows\SerialNumber.txt" ( if exist "%HOMEDRIVE%\windows\SerialNumber.txt" (
echo C:\windows\SerialNumber.txt exists echo %HOMEDRIVE%\windows\SerialNumber.txt exists
) else ( ) else (
echo C:\windows\SerialNumber.txt does not exist echo %HOMEDRIVE%\windows\SerialNumber.txt does not exist
) )
if exist "C:\unattend.xml" ( if exist "%HOMEDRIVE%\unattend.xml" (
echo C:\unattend.xml exists echo %HOMEDRIVE%\unattend.xml exists
) else ( ) else (
echo C:\unattend.xml does not exist echo %HOMEDRIVE%\unattend.xml does not exist
) )
if exist "C:\Windows\Setup\Scripts\SetupComplete.cmd" ( if exist "%HOMEDRIVE%\Windows\Setup\Scripts\SetupComplete.cmd" (
echo C:\Windows\Setup\Scripts\SetupComplete.cmd exists echo %HOMEDRIVE%\Windows\Setup\Scripts\SetupComplete.cmd exists
) else ( ) 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" ( if exist "%HOMEDRIVE%\Windows\Panther\unattend.xml" (
echo C:\Windows\Panther\unattend.xml exists echo %HOMEDRIVE%\Windows\Panther\unattend.xml exists
) else ( ) 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" ( if exist "%HOMEDRIVE%\Windows\System32\Sysprep\unattend.xml" (
echo C:\Windows\System32\Sysprep\unattend.xml exists echo %HOMEDRIVE%\Windows\System32\Sysprep\unattend.xml exists
) else ( ) 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" ( if exist "%HOMEDRIVE%\Windows\FirstStartup.ps1" (
echo C:\Windows\FirstStartup.ps1 exists echo %HOMEDRIVE%\Windows\FirstStartup.ps1 exists
) else ( ) else (
echo C:\Windows\FirstStartup.ps1 does not exist echo %HOMEDRIVE%\Windows\FirstStartup.ps1 does not exist
) )
if exist "C:\Windows\winutil.ps1" ( if exist "%HOMEDRIVE%\Windows\winutil.ps1" (
echo C:\Windows\winutil.ps1 exists echo %HOMEDRIVE%\Windows\winutil.ps1 exists
) else ( ) else (
echo C:\Windows\winutil.ps1 does not exist echo %HOMEDRIVE%\Windows\winutil.ps1 does not exist
) )
if exist "C:\Windows\LogSpecialize.txt" ( if exist "%HOMEDRIVE%\Windows\LogSpecialize.txt" (
echo C:\Windows\LogSpecialize.txt exists echo %HOMEDRIVE%\Windows\LogSpecialize.txt exists
) else ( ) else (
echo C:\Windows\LogSpecialize.txt does not exist echo %HOMEDRIVE%\Windows\LogSpecialize.txt does not exist
) )
if exist "C:\Windows\LogAuditUser.txt" ( if exist "%HOMEDRIVE%\Windows\LogAuditUser.txt" (
echo C:\Windows\LogAuditUser.txt exists echo %HOMEDRIVE%\Windows\LogAuditUser.txt exists
) else ( ) else (
echo C:\Windows\LogAuditUser.txt does not exist echo %HOMEDRIVE%\Windows\LogAuditUser.txt does not exist
) )
if exist "C:\Windows\LogOobeSystem.txt" ( if exist "%HOMEDRIVE%\Windows\LogOobeSystem.txt" (
echo C:\Windows\LogOobeSystem.txt exists echo %HOMEDRIVE%\Windows\LogOobeSystem.txt exists
) else ( ) else (
echo C:\Windows\LogOobeSystem.txt does not exist echo %HOMEDRIVE%\Windows\LogOobeSystem.txt does not exist
) )
if exist "c:\windows\csup.txt" ( if exist "%HOMEDRIVE%\windows\csup.txt" (
echo c:\windows\csup.txt exists echo %HOMEDRIVE%\windows\csup.txt exists
) else ( ) else (
echo c:\windows\csup.txt does not exist echo %HOMEDRIVE%\windows\csup.txt does not exist
) )
if exist "c:\windows\LogFirstRun.txt" ( if exist "%HOMEDRIVE%\windows\LogFirstRun.txt" (
echo c:\windows\LogFirstRun.txt exists echo %HOMEDRIVE%\windows\LogFirstRun.txt exists
) else ( ) 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 $checkInstall | Out-File -FilePath "$env:temp\checkinstall.cmd" -Force -Encoding Ascii
@ -673,7 +785,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" $taskbarPath = "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
# Delete all files on the Taskbar # Delete all files on the Taskbar
@ -693,45 +805,19 @@ function New-FirstRun {
} }
} }
Remove-Item -Path "$env:USERPROFILE\Desktop\*.lnk" Remove-Item -Path "$env:USERPROFILE\Desktop\*.lnk"
Remove-Item -Path "C:\Users\Default\Desktop\*.lnk" Remove-Item -Path "$env:HOMEDRIVE\Users\Default\Desktop\*.lnk"
# ************************************************ try
# Create WinUtil shortcut on the desktop {
# if ((Get-WindowsOptionalFeature -Online | Where-Object { $_.FeatureName -like "Recall" }).Count -gt 0)
$desktopPath = "$($env:USERPROFILE)\Desktop" {
# Specify the target PowerShell command Disable-WindowsOptionalFeature -Online -FeatureName "Recall" -Remove
$command = "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command 'irm https://christitus.com/win | iex'" }
# Specify the path for the shortcut
$shortcutPath = Join-Path $desktopPath 'winutil.lnk'
# Create a shell object
$shell = New-Object -ComObject WScript.Shell
# Create a shortcut object
$shortcut = $shell.CreateShortcut($shortcutPath)
if (Test-Path -Path "c:\Windows\cttlogo.png") {
$shortcut.IconLocation = "c:\Windows\cttlogo.png"
} }
catch
{
# Set properties of the shortcut }
$shortcut.TargetPath = "powershell.exe"
$shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`""
# Save the shortcut
$shortcut.Save()
# Make the shortcut have 'Run as administrator' property on
$bytes = [System.IO.File]::ReadAllBytes($shortcutPath)
# Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex
$bytes[0x15] = $bytes[0x15] -bor 0x20
[System.IO.File]::WriteAllBytes($shortcutPath, $bytes)
Write-Host "Shortcut created at: $shortcutPath"
#
# Done create WinUtil shortcut on the desktop
# ************************************************
Start-Process explorer
'@ '@
$firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force $firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force
} }

View 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"
}

View File

@ -0,0 +1,180 @@
function Invoke-WinutilThemeChange {
<#
.SYNOPSIS
Toggles between light and dark themes for a Windows utility application.
.DESCRIPTION
This function toggles the theme of the user interface between 'Light' and 'Dark' modes,
modifying various UI elements such as colors, margins, corner radii, font families, etc.
If the '-init' switch is used, it initializes the theme based on the system's current dark mode setting.
.PARAMETER init
A switch parameter. If set to $true, the function initializes the theme based on the systems current dark mode setting.
.EXAMPLE
Invoke-WinutilThemeChange
# Toggles the theme between 'Light' and 'Dark'.
.EXAMPLE
Invoke-WinutilThemeChange -init
# Initializes the theme based on the system's dark mode and applies the shared theme.
#>
param (
[switch]$init = $false,
[string]$theme
)
function Set-WinutilTheme {
<#
.SYNOPSIS
Applies the specified theme to the application's user interface.
.DESCRIPTION
This internal function applies the given theme by setting the relevant properties
like colors, font families, corner radii, etc., in the UI. It uses the
'Set-ThemeResourceProperty' helper function to modify the application's resources.
.PARAMETER currentTheme
The name of the theme to be applied. Common values are "Light", "Dark", or "shared".
#>
param (
[string]$currentTheme
)
function Set-ThemeResourceProperty {
<#
.SYNOPSIS
Sets a specific UI property in the application's resources.
.DESCRIPTION
This helper function sets a property (e.g., color, margin, corner radius) in the
application's resources, based on the provided type and value. It includes
error handling to manage potential issues while setting a property.
.PARAMETER Name
The name of the resource property to modify (e.g., "MainBackgroundColor", "ButtonBackgroundMouseoverColor").
.PARAMETER Value
The value to assign to the resource property (e.g., "#FFFFFF" for a color).
.PARAMETER Type
The type of the resource, such as "ColorBrush", "CornerRadius", "GridLength", or "FontFamily".
#>
param($Name, $Value, $Type)
try {
# Set the resource property based on its type
$sync.Form.Resources[$Name] = switch ($Type) {
"ColorBrush" { [Windows.Media.SolidColorBrush]::new($Value) }
"Color" {
# Convert hex string to RGB values
$hexColor = $Value.TrimStart("#")
$r = [Convert]::ToInt32($hexColor.Substring(0,2), 16)
$g = [Convert]::ToInt32($hexColor.Substring(2,2), 16)
$b = [Convert]::ToInt32($hexColor.Substring(4,2), 16)
[Windows.Media.Color]::FromRgb($r, $g, $b)
}
"CornerRadius" { [System.Windows.CornerRadius]::new($Value) }
"GridLength" { [System.Windows.GridLength]::new($Value) }
"Thickness" {
# Parse the Thickness value (supports 1, 2, or 4 inputs)
$values = $Value -split ","
switch ($values.Count) {
1 { [System.Windows.Thickness]::new([double]$values[0]) }
2 { [System.Windows.Thickness]::new([double]$values[0], [double]$values[1]) }
4 { [System.Windows.Thickness]::new([double]$values[0], [double]$values[1], [double]$values[2], [double]$values[3]) }
}
}
"FontFamily" { [Windows.Media.FontFamily]::new($Value) }
"Double" { [double]$Value }
default { $Value }
}
}
catch {
# Log a warning if there's an issue setting the property
Write-Warning "Failed to set property $($Name): $_"
}
}
# Retrieve all theme properties from the theme configuration
$themeProperties = $sync.configs.themes.$currentTheme.PSObject.Properties
foreach ($_ in $themeProperties) {
# Apply properties that deal with colors
if ($_.Name -like "*color*") {
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "ColorBrush"
# For certain color properties, also set complementary values (e.g., BorderColor -> CBorderColor) This is required because e.g DropShadowEffect requires a <Color> and not a <SolidColorBrush> object
if ($_.Name -in @("BorderColor", "ButtonBackgroundMouseoverColor")) {
Set-ThemeResourceProperty -Name "C$($_.Name)" -Value $_.Value -Type "Color"
}
}
# Apply corner radius properties
elseif ($_.Name -like "*Radius*") {
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "CornerRadius"
}
# Apply row height properties
elseif ($_.Name -like "*RowHeight*") {
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "GridLength"
}
# Apply thickness or margin properties
elseif (($_.Name -like "*Thickness*") -or ($_.Name -like "*margin")) {
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "Thickness"
}
# Apply font family properties
elseif ($_.Name -like "*FontFamily*") {
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "FontFamily"
}
# Apply any other properties as doubles (numerical values)
else {
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "Double"
}
}
}
$LightPreferencePath = "$env:LOCALAPPDATA\winutil\LightTheme.ini"
$DarkPreferencePath = "$env:LOCALAPPDATA\winutil\DarkTheme.ini"
if ($init) {
Set-WinutilTheme -currentTheme "shared"
if (Test-Path $LightPreferencePath) {
$theme = "Light"
}
elseif (Test-Path $DarkPreferencePath) {
$theme = "Dark"
}
else {
$theme = "Auto"
}
}
switch ($theme) {
"Auto" {
$systemUsesDarkMode = Get-WinUtilToggleStatus WPFToggleDarkMode
if ($systemUsesDarkMode) {
Set-WinutilTheme -currentTheme "Dark"
}
else{
Set-WinutilTheme -currentTheme "Light"
}
$themeButtonIcon = [char]0xF08C
Remove-Item $LightPreferencePath -Force -ErrorAction SilentlyContinue
Remove-Item $DarkPreferencePath -Force -ErrorAction SilentlyContinue
}
"Dark" {
Set-WinutilTheme -currentTheme $theme
$themeButtonIcon = [char]0xE708
$null = New-Item $DarkPreferencePath -Force
Remove-Item $LightPreferencePath -Force -ErrorAction SilentlyContinue
}
"Light" {
Set-WinutilTheme -currentTheme $theme
$themeButtonIcon = [char]0xE706
$null = New-Item $LightPreferencePath -Force
Remove-Item $DarkPreferencePath -Force -ErrorAction SilentlyContinue
}
}
# Update the theme selector button with the appropriate icon
$ThemeButton = $sync.Form.FindName("ThemeButton")
$ThemeButton.Content = [string]$themeButtonIcon
}

View File

@ -36,7 +36,12 @@ function Set-WinUtilRegistry {
} }
Write-Host "Set $Path\$Name to $Value" Write-Host "Set $Path\$Name to $Value"
Set-ItemProperty -Path $Path -Name $Name -Type $Type -Value $Value -Force -ErrorAction Stop | Out-Null 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] { } catch [System.Security.SecurityException] {
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception" Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
} catch [System.Management.Automation.ItemNotFoundException] { } catch [System.Management.Automation.ItemNotFoundException] {

View File

@ -1,83 +0,0 @@
function Set-WinUtilUITheme {
<#
.SYNOPSIS
Sets the theme of the XAML file
.PARAMETER inputXML
A string representing the XAML object to modify
.PARAMETER customThemeName
The name of the custom theme to set the XAML to. Defaults to 'matrix'
.PARAMETER defaultThemeName
The name of the default theme to use when setting the XAML. Defaults to '_default'
.EXAMPLE
$returnVal = Set-WinUtilUITheme -inputXAML $inputXAML
if ($returnVal[0] -eq "") {
Write-Host "Failed to process inputXML"
} else {
$inputXML = $returnVal[0]
}
# to know which theme this function has used, access the second item in returned value.
Write-Host "Theme used in processing: $($returnVal[1])"
#>
param (
[Parameter(Mandatory, position=0)]
[string]$inputXML,
[Parameter(position=1)]
[string]$customThemeName = 'matrix',
[Parameter(position=2)]
[string]$defaultThemeName = '_default'
)
try {
# Note:
# Reason behind not caching the '$sync.configs.themes` object into a variable,
# because this code can modify the themes object.. meaning it's better to access it
# using the more verbose way, rather than introduce possible bugs into the code, just for the sake of readability.
#
if (-NOT $sync.configs.themes) {
throw [GenericException]::new("[Set-WinUtilTheme] Did not find 'config.themes' inside `$sync variable.")
}
if (-NOT $sync.configs.themes.$defaultThemeName) {
throw [GenericException]::new("[Set-WinUtilTheme] Did not find '$defaultThemeName' theme in the themes config file.")
}
$themeToUse = $customThemeName
if ($sync.configs.themes.$themeToUse) {
# Loop through every default theme option, and modify the custom theme in $sync variable,
# so that it has full options available for other functions to use.
foreach ($option in $sync.configs.themes.$defaultThemeName.PSObject.Properties) {
$optionName = $option.Name
$optionValue = $option.Value
if (-NOT $sync.configs.themes.$themeToUse.$optionName) {
$sync.configs.themes.$themeToUse | Add-Member -MemberType NoteProperty -Name $optionName -Value $optionValue
}
}
} else {
Write-Debug "[Set-WinUtilTheme] Theme '$customThemeName' was not found, using '$defaultThemeName' instead."
$themeToUse = $defaultThemeName
}
foreach ($property in $sync.configs.themes.$themeToUse.PSObject.Properties) {
$key = $property.Name
$value = $property.Value
# Add curly braces around the key
$formattedKey = "{$key}"
# Replace the key with the value in the input XML
$inputXML = $inputXML.Replace($formattedKey, $value)
}
}
catch {
Write-Host "[Set-WinUtilTheme] Unable to apply theme" -ForegroundColor Red
Write-Host "$($psitem.Exception.Message)" -ForegroundColor Red
$inputXML = "" # Make inputXML equal an empty string, indicating something went wrong to the function caller.
}
return @($inputXML, $themeToUse);
}

View File

@ -33,25 +33,25 @@ function Show-CustomDialog {
#> #>
param( param(
[string]$Message, [string]$Message,
[int]$Width = 300, [int]$Width = $sync.Form.Resources.CustomDialogWidth,
[int]$Height = 200, [int]$Height = $sync.Form.Resources.CustomDialogHeight,
[int]$FontSize = 10, [int]$FontSize = $sync.Form.Resources.CustomDialogFontSize,
[int]$HeaderFontSize = 14, [int]$HeaderFontSize = $sync.Form.Resources.CustomDialogFontSizeHeader,
[int]$IconSize = 25, [int]$IconSize = $sync.Form.Resources.CustomDialogLogoSize,
[bool]$EnableScroll = $false [bool]$EnableScroll = $false
) )
Add-Type -AssemblyName PresentationFramework Add-Type -AssemblyName PresentationFramework
# Define theme colors # Define theme colors
$foregroundColor = $sync.configs.themes.$ctttheme.MainForegroundColor $foregroundColor = $sync.Form.Resources.MainForegroundColor
$backgroundColor = $sync.configs.themes.$ctttheme.MainBackgroundColor $backgroundColor = $sync.Form.Resources.MainBackgroundColor
$font = New-Object Windows.Media.FontFamily("Consolas") $font = New-Object Windows.Media.FontFamily("Consolas")
$borderColor = $sync.configs.themes.$ctttheme.BorderColor # ButtonInstallBackgroundColor $borderColor = $sync.Form.Resources.BorderColor # ButtonInstallBackgroundColor
$buttonBackgroundColor = $sync.configs.themes.$ctttheme.ButtonInstallBackgroundColor $buttonBackgroundColor = $sync.Form.Resources.ButtonInstallBackgroundColor
$buttonForegroundColor = $sync.configs.themes.$ctttheme.ButtonInstallForegroundColor $buttonForegroundColor = $sync.Form.Resources.ButtonInstallForegroundColor
$shadowColor = [Windows.Media.ColorConverter]::ConvertFromString("#AAAAAAAA") $shadowColor = [Windows.Media.ColorConverter]::ConvertFromString("#AAAAAAAA")
$logocolor = $sync.configs.themes.$ctttheme.LabelboxForegroundColor $logocolor = $sync.Form.Resources.LabelboxForegroundColor
# Create a custom dialog window # Create a custom dialog window
$dialog = New-Object Windows.Window $dialog = New-Object Windows.Window
@ -162,7 +162,7 @@ function Show-CustomDialog {
$hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value) $hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value)
$hyperlink.Inlines.Add($match.Groups[2].Value) $hyperlink.Inlines.Add($match.Groups[2].Value)
$hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline $hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline
$hyperlink.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor $hyperlink.Foreground = $sync.Form.Resources.LinkForegroundColor
$hyperlink.Add_Click({ $hyperlink.Add_Click({
param($sender, $args) param($sender, $args)
@ -170,11 +170,11 @@ function Show-CustomDialog {
}) })
$hyperlink.Add_MouseEnter({ $hyperlink.Add_MouseEnter({
param($sender, $args) param($sender, $args)
$sender.Foreground = $sync.configs.themes.$ctttheme.LinkHoverForegroundColor $sender.Foreground = $sync.Form.Resources.LinkHoverForegroundColor
}) })
$hyperlink.Add_MouseLeave({ $hyperlink.Add_MouseLeave({
param($sender, $args) param($sender, $args)
$sender.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor $sender.Foreground = $sync.Form.Resources.LinkForegroundColor
}) })
$messageTextBlock.Inlines.Add($hyperlink) $messageTextBlock.Inlines.Add($hyperlink)

View File

@ -19,7 +19,6 @@ function Invoke-WPFButton {
} }
Switch -Wildcard ($Button) { Switch -Wildcard ($Button) {
"WPFTab?BT" {Invoke-WPFTab $Button} "WPFTab?BT" {Invoke-WPFTab $Button}
"WPFInstall" {Invoke-WPFInstall} "WPFInstall" {Invoke-WPFInstall}
"WPFUninstall" {Invoke-WPFUnInstall} "WPFUninstall" {Invoke-WPFUnInstall}
@ -51,7 +50,6 @@ function Invoke-WPFButton {
"WPFFixesNetwork" {Invoke-WPFFixesNetwork} "WPFFixesNetwork" {Invoke-WPFFixesNetwork}
"WPFUpdatesdisable" {Invoke-WPFUpdatesdisable} "WPFUpdatesdisable" {Invoke-WPFUpdatesdisable}
"WPFUpdatessecurity" {Invoke-WPFUpdatessecurity} "WPFUpdatessecurity" {Invoke-WPFUpdatessecurity}
"WPFWinUtilShortcut" {Invoke-WPFShortcut -ShortcutToAdd "WinUtil" -RunAsAdmin $true}
"WPFGetInstalled" {Invoke-WPFGetInstalled -CheckBox "winget"} "WPFGetInstalled" {Invoke-WPFGetInstalled -CheckBox "winget"}
"WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"} "WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"}
"WPFGetIso" {Invoke-WPFGetIso} "WPFGetIso" {Invoke-WPFGetIso}
@ -59,5 +57,6 @@ function Invoke-WPFButton {
"WPFCloseButton" {Invoke-WPFCloseButton} "WPFCloseButton" {Invoke-WPFCloseButton}
"MicrowinScratchDirBT" {Invoke-ScratchDialog} "MicrowinScratchDirBT" {Invoke-ScratchDialog}
"WPFWinUtilPSProfile" {Invoke-WinUtilpsProfile} "WPFWinUtilPSProfile" {Invoke-WinUtilpsProfile}
"WPFWinUtilSSHServer" {Invoke-WinUtilSSHServer}
} }
} }

View File

@ -62,17 +62,79 @@ function Invoke-WPFGetIso {
} }
} }
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null if ($sync["ISOmanual"].IsChecked) {
$openFileDialog = New-Object System.Windows.Forms.OpenFileDialog # Open file dialog to let user choose the ISO file
$openFileDialog.initialDirectory = $initialDirectory [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
$openFileDialog.filter = "ISO files (*.iso)| *.iso" $openFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$openFileDialog.ShowDialog() | Out-Null $openFileDialog.initialDirectory = $initialDirectory
$filePath = $openFileDialog.FileName $openFileDialog.filter = "ISO files (*.iso)| *.iso"
$openFileDialog.ShowDialog() | Out-Null
$filePath = $openFileDialog.FileName
if ([string]::IsNullOrEmpty($filePath)) { if ([string]::IsNullOrEmpty($filePath)) {
Write-Host "No ISO is chosen" Write-Host "No ISO is chosen"
$sync.BusyMessage.Visibility="Hidden" $sync.BusyMessage.Visibility="Hidden"
return return
}
} elseif ($sync["ISOdownloader"].IsChecked) {
# Create folder browsers for user-specified locations
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
$isoDownloaderFBD = New-Object System.Windows.Forms.FolderBrowserDialog
$isoDownloaderFBD.Description = "Please specify the path to download the ISO file to:"
$isoDownloaderFBD.ShowNewFolderButton = $true
if ($isoDownloaderFBD.ShowDialog() -ne [System.Windows.Forms.DialogResult]::OK)
{
return
}
# Grab the location of the selected path
$targetFolder = $isoDownloaderFBD.SelectedPath
# Auto download newest ISO
# Credit: https://github.com/pbatard/Fido
$fidopath = "$env:temp\Fido.ps1"
$originalLocation = $PSScriptRoot
Invoke-WebRequest "https://github.com/pbatard/Fido/raw/master/Fido.ps1" -OutFile $fidopath
Set-Location -Path $env:temp
# Detect if the first option ("System language") has been selected and get a Fido-approved language from the current culture
$lang = if ($sync["ISOLanguage"].SelectedIndex -eq 0) {
Get-FidoLangFromCulture -langName (Get-Culture).Name
} else {
$sync["ISOLanguage"].SelectedItem
}
& $fidopath -Win 'Windows 11' -Rel $sync["ISORelease"].SelectedItem -Arch "x64" -Lang $lang -Ed "Windows 11 Home/Pro/Edu"
if (-not $?)
{
Write-Host "Could not download the ISO file. Look at the output of the console for more information."
$msg = "The ISO file could not be downloaded"
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
return
}
Set-Location $originalLocation
# Use the FullName property to only grab the file names. Using this property is necessary as, without it, you're passing the usual output of Get-ChildItem
# to the variable, and let's be honest, that does NOT exist in the file system
$filePath = (Get-ChildItem -Path "$env:temp" -Filter "Win11*.iso").FullName | Sort-Object LastWriteTime -Descending | Select-Object -First 1
$fileName = [IO.Path]::GetFileName("$filePath")
if (($targetFolder -ne "") -and (Test-Path "$targetFolder"))
{
try
{
# "Let it download to $env:TEMP and then we **move** it to the file path." - CodingWonders
$destinationFilePath = "$targetFolder\$fileName"
Write-Host "Moving ISO file. Please wait..."
Move-Item -Path "$filePath" -Destination "$destinationFilePath" -Force
$filePath = $destinationFilePath
}
catch
{
Write-Host "Unable to move the ISO file to the location you specified. The downloaded ISO is in the `"$env:TEMP`" folder"
Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
}
}
} }
Write-Host "File path $($filePath)" Write-Host "File path $($filePath)"
@ -198,19 +260,25 @@ function Invoke-WPFGetIso {
$wimFile = $wimFile.Replace(".wim", ".esd").Trim() $wimFile = $wimFile.Replace(".wim", ".esd").Trim()
} }
$sync.MicrowinWindowsFlavors.Items.Clear() $sync.MicrowinWindowsFlavors.Items.Clear()
Get-WindowsImage -ImagePath $wimFile | ForEach-Object {
$images = Get-WindowsImage -ImagePath $wimFile
# Populate the list of Windows flavors and find the Pro edition
$images | ForEach-Object {
$imageIdx = $_.ImageIndex $imageIdx = $_.ImageIndex
$imageName = $_.ImageName $imageName = $_.ImageName
$sync.MicrowinWindowsFlavors.Items.Add("$imageIdx : $imageName") $sync.MicrowinWindowsFlavors.Items.Add("$imageIdx : $imageName")
}
$sync.MicrowinWindowsFlavors.SelectedIndex = 0 $sync.MicrowinWindowsFlavors.SelectedIndex = 0
Write-Host "Finding suitable Pro edition. This can take some time. Do note that this is an automatic process that might not select the edition you want." Write-Host "Finding suitable Pro edition. This can take some time. Do note that this is an automatic process that might not select the edition you want."
Get-WindowsImage -ImagePath $wimFile | ForEach-Object {
if ((Get-WindowsImage -ImagePath $wimFile -Index $_.ImageIndex).EditionId -eq "Professional") { if ((Get-WindowsImage -ImagePath $wimFile -Index $_.ImageIndex).EditionId -eq "Professional") {
# We have found the Pro edition # We have found the Pro edition
$sync.MicrowinWindowsFlavors.SelectedIndex = $_.ImageIndex - 1 $sync.MicrowinWindowsFlavors.SelectedIndex = $_.ImageIndex - 1
} }
} }
Get-Volume $driveLetter | Get-DiskImage | Dismount-DiskImage Get-Volume $driveLetter | Get-DiskImage | Dismount-DiskImage
Write-Host "Selected value '$($sync.MicrowinWindowsFlavors.SelectedValue)'....." Write-Host "Selected value '$($sync.MicrowinWindowsFlavors.SelectedValue)'....."

View File

@ -19,45 +19,59 @@ function Invoke-WPFImpex {
$Config = $null $Config = $null
) )
if ($type -eq "export") { function ConfigDialog {
$FileBrowser = New-Object System.Windows.Forms.SaveFileDialog if (!$Config) {
} switch ($type) {
if ($type -eq "import") { "export" { $FileBrowser = New-Object System.Windows.Forms.SaveFileDialog }
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog "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) { if ($FileBrowser.FileName -eq "") {
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop') return $null
$FileBrowser.Filter = "JSON Files (*.json)|*.json" } else {
$FileBrowser.ShowDialog() | Out-Null return $FileBrowser.FileName
}
if($FileBrowser.FileName -eq "") {
return
} else { } else {
$Config = $FileBrowser.FileName return $Config
} }
} }
if ($type -eq "export") { switch ($type) {
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false "export" {
$jsonFile | ConvertTo-Json | Out-File $FileBrowser.FileName -Force try {
$runscript = "iex ""& { `$(irm christitus.com/win) } -Config '$($FileBrowser.FileName)'""" $Config = ConfigDialog
$runscript | Set-Clipboard if ($Config) {
} $jsonFile = Get-WinUtilCheckBoxes -unCheck $false | ConvertTo-Json
if ($type -eq "import") { $jsonFile | Out-File $Config -Force
$jsonFile = Get-Content $Config | ConvertFrom-Json "iex ""& { `$(irm christitus.com/win) } -Config '$Config'""" | Set-Clipboard
$flattenedJson = @()
$jsonFile.PSObject.Properties | ForEach-Object {
$category = $_.Name
foreach ($checkboxName in $_.Value) {
if ($category -ne "Install") {
$flattenedJson += $checkboxName
} }
} 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: $_"
} }
} }
$flattenedJson = [string]$flattenedJson
Invoke-WPFPresets -preset $flattenedJson -imported $true
} }
} }

View File

@ -20,7 +20,7 @@ function Invoke-WPFInstall {
return return
} }
$ChocoPreference = $($sync.WPFpreferChocolatey.IsChecked) $ChocoPreference = $($sync.WPFpreferChocolatey.IsChecked)
Invoke-WPFRunspace -ArgumentList $PackagesToInstall,$ChocoPreference -DebugPreference $DebugPreference -ScriptBlock { $installHandle = Invoke-WPFRunspace -ParameterList @(("PackagesToInstall", $PackagesToInstall),("ChocoPreference", $ChocoPreference)) -DebugPreference $DebugPreference -ScriptBlock {
param($PackagesToInstall, $ChocoPreference, $DebugPreference) param($PackagesToInstall, $ChocoPreference, $DebugPreference)
if ($PackagesToInstall.count -eq 1) { if ($PackagesToInstall.count -eq 1) {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })

View File

@ -51,10 +51,6 @@ public class PowerManagement {
$index = $sync.MicrowinWindowsFlavors.SelectedValue.Split(":")[0].Trim() $index = $sync.MicrowinWindowsFlavors.SelectedValue.Split(":")[0].Trim()
Write-Host "Index chosen: '$index' from $($sync.MicrowinWindowsFlavors.SelectedValue)" 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 $copyToUSB = $sync.WPFMicrowinCopyToUsb.IsChecked
$injectDrivers = $sync.MicrowinInjectDrivers.IsChecked $injectDrivers = $sync.MicrowinInjectDrivers.IsChecked
$importDrivers = $sync.MicrowinImportDrivers.IsChecked $importDrivers = $sync.MicrowinImportDrivers.IsChecked
@ -91,6 +87,14 @@ public class PowerManagement {
return 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 $mountDirExists = Test-Path $mountDir
$scratchDirExists = Test-Path $scratchDir $scratchDirExists = Test-Path $scratchDir
if (-not $mountDirExists -or -not $scratchDirExists) { if (-not $mountDirExists -or -not $scratchDirExists) {
@ -158,6 +162,35 @@ public class PowerManagement {
Write-Host "Removing Appx Bloat" Write-Host "Removing Appx Bloat"
Remove-ProvisionedPackages Remove-ProvisionedPackages
# 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)
{
try
{
if (Test-Path "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" -PathType Leaf)
{
# Found the culprit. Do the following:
# 1. Take ownership of the file, from TrustedInstaller to Administrators
takeown /F "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" /A
# 2. Set ACLs so that we can write to it
icacls "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" /grant "$(Get-LocalizedUsers -admins $true):(M)" | Out-Host
# 3. Open the file and do the modification
$appxManifest = Get-Content -Path "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml"
$originalLine = $appxManifest[13]
$dependency = "`n <PackageDependency Name=`"Microsoft.WindowsAppRuntime.CBS`" MinVersion=`"1.0.0.0`" Publisher=`"CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US`" />"
$appxManifest[13] = "$originalLine$dependency"
Set-Content -Path "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" -Value $appxManifest -Force -Encoding utf8
}
}
catch
{
}
}
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup" -Directory Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup" -Directory
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\DiagTrack" -Directory Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\DiagTrack" -Directory
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\InboxApps" -Directory Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\InboxApps" -Directory
@ -238,6 +271,9 @@ public class PowerManagement {
# Write-Host Error code $LASTEXITCODE # Write-Host Error code $LASTEXITCODE
Write-Host "Done disabling Teams" 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)" 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 "SV1" /t REG_DWORD /d 0 /f
reg add "HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d 0 /f reg add "HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d 0 /f
@ -289,6 +325,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 "AppsUseLightTheme" /t REG_DWORD /d 0 /f
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "SystemUsesLightTheme" /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 { } catch {
Write-Error "An unexpected error occurred: $_" Write-Error "An unexpected error occurred: $_"
} finally { } finally {

View File

@ -17,7 +17,7 @@ function Invoke-WPFPresets {
param ( param (
[Parameter(position=0)] [Parameter(position=0)]
[string]$preset = "", [Array]$preset = "",
[Parameter(position=1)] [Parameter(position=1)]
[bool]$imported = $false, [bool]$imported = $false,
@ -51,7 +51,7 @@ function Invoke-WPFPresets {
} }
# Check if the checkbox name exists in the flattened JSON hashtable # Check if the checkbox name exists in the flattened JSON hashtable
if ($CheckBoxesToCheck.Contains($checkboxName)) { if ($CheckBoxesToCheck -contains $checkboxName) {
# If it exists, set IsChecked to true # If it exists, set IsChecked to true
$sync.$checkboxName.IsChecked = $true $sync.$checkboxName.IsChecked = $true
Write-Debug "$checkboxName is checked" Write-Debug "$checkboxName is checked"

View File

@ -11,17 +11,23 @@ function Invoke-WPFRunspace {
.PARAMETER ArgumentList .PARAMETER ArgumentList
A list of arguments to pass to the runspace A list of arguments to pass to the runspace
.PARAMETER ParameterList
A list of named parameters that should be provided.
.EXAMPLE .EXAMPLE
Invoke-WPFRunspace ` Invoke-WPFRunspace `
-ScriptBlock $sync.ScriptsInstallPrograms ` -ScriptBlock $sync.ScriptsInstallPrograms `
-ArgumentList "Installadvancedip,Installbitwarden" ` -ArgumentList "Installadvancedip,Installbitwarden" `
Invoke-WPFRunspace`
-ScriptBlock $sync.ScriptsInstallPrograms `
-ParameterList @(("PackagesToInstall", @("Installadvancedip,Installbitwarden")),("ChocoPreference", $true))
#> #>
[CmdletBinding()] [CmdletBinding()]
Param ( Param (
$ScriptBlock, $ScriptBlock,
$ArgumentList, $ArgumentList,
$ParameterList,
$DebugPreference $DebugPreference
) )
@ -30,8 +36,10 @@ function Invoke-WPFRunspace {
# Add Scriptblock and Arguments to runspace # Add Scriptblock and Arguments to runspace
$script:powershell.AddScript($ScriptBlock) $script:powershell.AddScript($ScriptBlock)
foreach ($Argument in $ArgumentList) { $script:powershell.AddArgument($ArgumentList)
$script:powershell.AddArgument($Argument)
foreach ($parameter in $ParameterList) {
$script:powershell.AddParameter($parameter[0], $parameter[1])
} }
$script:powershell.AddArgument($DebugPreference) # Pass DebugPreference to the script block $script:powershell.AddArgument($DebugPreference) # Pass DebugPreference to the script block
$script:powershell.RunspacePool = $sync.runspace $script:powershell.RunspacePool = $sync.runspace
@ -47,4 +55,6 @@ function Invoke-WPFRunspace {
$sync.runspace.Close() $sync.runspace.Close()
[System.GC]::Collect() [System.GC]::Collect()
} }
# Return the handle
return $handle
} }

View File

@ -1,72 +0,0 @@
function Invoke-WPFShortcut {
<#
.SYNOPSIS
Creates a shortcut and prompts for a save location
.PARAMETER ShortcutToAdd
The name of the shortcut to add
.PARAMETER RunAsAdmin
A boolean value to make 'Run as administrator' property on (true) or off (false), defaults to off
#>
param(
$ShortcutToAdd,
[bool]$RunAsAdmin = $false
)
# Preper the Shortcut Fields and add an a Custom Icon if it's available, else don't add a Custom Icon.
Switch ($ShortcutToAdd) {
"WinUtil" {
# Use Powershell 7 if installed and fallback to PS5 if not
if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
$shell = "pwsh.exe"
} else {
$shell = "powershell.exe"
}
$shellArgs = "-ExecutionPolicy Bypass -Command `"Start-Process $shell -verb runas -ArgumentList `'-Command `"irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1 | iex`"`'"
$DestinationName = "WinUtil.lnk"
}
}
# Show a File Dialog Browser, to let the User choose the Name and Location of where to save the Shortcut
$FileBrowser = New-Object System.Windows.Forms.SaveFileDialog
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
$FileBrowser.Filter = "Shortcut Files (*.lnk)|*.lnk"
$FileBrowser.FileName = $DestinationName
# Do an Early Return if the Save Operation was canceled by User's Input.
$FileBrowserResult = $FileBrowser.ShowDialog()
$DialogResultEnum = New-Object System.Windows.Forms.DialogResult
if (-not ($FileBrowserResult -eq $DialogResultEnum::OK)) {
return
}
# Prepare the Shortcut paramter
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName)
$Shortcut.TargetPath = $shell
$Shortcut.Arguments = $shellArgs
if (-NOT (Test-Path -Path $winutildir["logo.ico"])) {
Invoke-WebRequest -Uri "https://christitus.com/images/logo-full.ico" -OutFile $winutildir["logo.ico"]
}
if (Test-Path -Path $winutildir["logo.ico"]) {
$shortcut.IconLocation = $winutildir["logo.ico"]
}
# Save the Shortcut to disk
$Shortcut.Save()
if ($RunAsAdmin -eq $true) {
$bytes = [System.IO.File]::ReadAllBytes($FileBrowser.FileName)
# Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex
$bytes[0x15] = $bytes[0x15] -bor 0x20
[System.IO.File]::WriteAllBytes($FileBrowser.FileName, $bytes)
}
Write-Host "Shortcut for $ShortcutToAdd has been saved to $($FileBrowser.FileName) with 'Run as administrator' set to $RunAsAdmin"
}

View File

@ -27,7 +27,7 @@ function Invoke-WPFUIElements {
$window = $sync["Form"] $window = $sync["Form"]
$theme = $sync.configs.themes.$ctttheme $theme = $sync.Form.Resources
$borderstyle = $window.FindResource("BorderStyle") $borderstyle = $window.FindResource("BorderStyle")
$HoverTextBlockStyle = $window.FindResource("HoverTextBlockStyle") $HoverTextBlockStyle = $window.FindResource("HoverTextBlockStyle")
$ColorfulToggleSwitchStyle = $window.FindResource("ColorfulToggleSwitchStyle") $ColorfulToggleSwitchStyle = $window.FindResource("ColorfulToggleSwitchStyle")
@ -186,7 +186,7 @@ function Invoke-WPFUIElements {
$label.ToolTip = $entryInfo.Description $label.ToolTip = $entryInfo.Description
$label.HorizontalAlignment = "Left" $label.HorizontalAlignment = "Left"
$label.FontSize = $theme.FontSize $label.FontSize = $theme.FontSize
$label.Foreground = $theme.MainForegroundColor $label.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
$dockPanel.Children.Add($label) | Out-Null $dockPanel.Children.Add($label) | Out-Null
$stackPanel.Children.Add($dockPanel) | Out-Null $stackPanel.Children.Add($dockPanel) | Out-Null
@ -207,14 +207,14 @@ function Invoke-WPFUIElements {
$toggleButton.HorizontalAlignment = "Left" $toggleButton.HorizontalAlignment = "Left"
$toggleButton.Height = $theme.TabButtonHeight $toggleButton.Height = $theme.TabButtonHeight
$toggleButton.Width = $theme.TabButtonWidth $toggleButton.Width = $theme.TabButtonWidth
$toggleButton.Background = $theme.ButtonInstallBackgroundColor $toggleButton.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "ButtonInstallBackgroundColor")
$toggleButton.Foreground = [Windows.Media.Brushes]::White $toggleButton.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
$toggleButton.FontWeight = [Windows.FontWeights]::Bold $toggleButton.FontWeight = [Windows.FontWeights]::Bold
$textBlock = New-Object Windows.Controls.TextBlock $textBlock = New-Object Windows.Controls.TextBlock
$textBlock.FontSize = $theme.TabButtonFontSize $textBlock.FontSize = $theme.TabButtonFontSize
$textBlock.Background = [Windows.Media.Brushes]::Transparent $textBlock.Background = [Windows.Media.Brushes]::Transparent
$textBlock.Foreground = $theme.ButtonInstallForegroundColor $textBlock.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "ButtonInstallForegroundColor")
$underline = New-Object Windows.Documents.Underline $underline = New-Object Windows.Documents.Underline
$underline.Inlines.Add($entryInfo.name -replace "(.).*", "`$1") $underline.Inlines.Add($entryInfo.name -replace "(.).*", "`$1")
@ -292,7 +292,7 @@ function Invoke-WPFUIElements {
$checkBox.FontSize = $theme.FontSize $checkBox.FontSize = $theme.FontSize
$checkBox.ToolTip = $entryInfo.Description $checkBox.ToolTip = $entryInfo.Description
$checkBox.Margin = $theme.CheckBoxMargin $checkBox.Margin = $theme.CheckBoxMargin
if ($entryInfo.Checked) { if ($entryInfo.Checked -eq $true) {
$checkBox.IsChecked = $entryInfo.Checked $checkBox.IsChecked = $entryInfo.Checked
} }
$horizontalStackPanel.Children.Add($checkBox) | Out-Null $horizontalStackPanel.Children.Add($checkBox) | Out-Null

View File

@ -50,14 +50,14 @@ Function Invoke-WPFUltimatePerformance {
} elseif ($State -eq "Disable") { } elseif ($State -eq "Disable") {
# Check if the Ultimate Performance plan is installed by GUID # Check if the Ultimate Performance plan is installed by GUID
$installedPlan = powercfg -list | Select-String -Pattern $ultimateGUID $installedPlan = (powercfg -list | Select-String -Pattern "ChrisTitus - Ultimate Power Plan").Line.Split()[3]
if ($installedPlan) { if ($installedPlan) {
# Extract the GUID of the installed Ultimate Performance plan # Extract the GUID of the installed Ultimate Performance plan
$ultimatePlanGUID = $installedPlan.Line.Split()[3] $ultimatePlanGUID = $installedPlan.Line.Split()[3]
# Set a different power plan as active before deleting the Ultimate Performance plan # Set a different power plan as active before deleting the Ultimate Performance plan
$balancedPlanGUID = (powercfg -list | Select-String -Pattern "Balanced").Line.Split()[3] $balancedPlanGUID = 381b4222-f694-41f0-9685-ff5bb260df2e
powercfg -setactive $balancedPlanGUID powercfg -setactive $balancedPlanGUID
# Delete the Ultimate Performance plan by GUID # Delete the Ultimate Performance plan by GUID

View File

@ -30,7 +30,7 @@ function Invoke-WPFUnInstall {
if($confirm -eq "No") {return} if($confirm -eq "No") {return}
$ChocoPreference = $($sync.WPFpreferChocolatey.IsChecked) $ChocoPreference = $($sync.WPFpreferChocolatey.IsChecked)
Invoke-WPFRunspace -ArgumentList $PackagesToInstall, $ChocoPreference -DebugPreference $DebugPreference -ScriptBlock { Invoke-WPFRunspace -ArgumentList @(("PackagesToInstall", $PackagesToInstall),("ChocoPreference", $ChocoPreference)) -DebugPreference $DebugPreference -ScriptBlock {
param($PackagesToInstall, $ChocoPreference, $DebugPreference) param($PackagesToInstall, $ChocoPreference, $DebugPreference)
if ($PackagesToInstall.count -eq 1) { if ($PackagesToInstall.count -eq 1) {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })

View File

@ -42,4 +42,24 @@ function Invoke-WPFUpdatesdefault {
Write-Host "===================================================" Write-Host "==================================================="
Write-Host "--- Windows Update Settings Reset to Default ---" Write-Host "--- Windows Update Settings Reset to Default ---"
Write-Host "===================================================" Write-Host "==================================================="
Start-Process -FilePath "secedit" -ArgumentList "/configure /cfg $env:windir\inf\defltbase.inf /db defltbase.sdb /verbose" -Wait
Start-Process -FilePath "cmd.exe" -ArgumentList "/c RD /S /Q $env:WinDir\System32\GroupPolicyUsers" -Wait
Start-Process -FilePath "cmd.exe" -ArgumentList "/c RD /S /Q $env:WinDir\System32\GroupPolicy" -Wait
Start-Process -FilePath "gpupdate" -ArgumentList "/force" -Wait
Remove-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKCU:\Software\Microsoft\WindowsSelfHost" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKCU:\Software\Policies" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKLM:\Software\Microsoft\Policies" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKLM:\Software\Microsoft\WindowsSelfHost" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKLM:\Software\Policies" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKLM:\Software\WOW6432Node\Microsoft\Policies" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" -Recurse -Force -ErrorAction SilentlyContinue
Write-Host "==================================================="
Write-Host "--- Windows Local Policies Reset to Default ---"
Write-Host "==================================================="
} }

View File

@ -24,8 +24,12 @@ function Invoke-WPFtweaksbutton {
Write-Debug "Number of tweaks to process: $($Tweaks.Count)" Write-Debug "Number of tweaks to process: $($Tweaks.Count)"
Invoke-WPFRunspace -ArgumentList $Tweaks -DebugPreference $DebugPreference -ScriptBlock { # The leading "," in the ParameterList is nessecary because we only provide one argument and powershell cannot be convinced that we want a nested loop with only one argument otherwise
param($Tweaks, $DebugPreference) $tweaksHandle = Invoke-WPFRunspace -ParameterList @(,("tweaks",$tweaks)) -DebugPreference $DebugPreference -ScriptBlock {
param(
$tweaks,
$DebugPreference
)
Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)" Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)"
$sync.ProcessRunning = $true $sync.ProcessRunning = $true
@ -38,8 +42,9 @@ function Invoke-WPFtweaksbutton {
# Execute other selected tweaks # Execute other selected tweaks
for ($i = 0; $i -lt $Tweaks.Count; $i++) { for ($i = 0; $i -lt $Tweaks.Count; $i++) {
Set-WinUtilProgressBar -Label "Applying $($tweaks[$i])" -Percent ($i / $Tweaks.Count * 100) Set-WinUtilProgressBar -Label "Applying $($tweaks[$i])" -Percent ($i / $tweaks.Count * 100)
Invoke-WinUtilTweaks $tweaks[$i]$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$Tweaks.Count) }) Invoke-WinUtilTweaks $tweaks[$i]
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$Tweaks.Count) })
} }
Set-WinUtilProgressBar -Label "Tweaks finished" -Percent 100 Set-WinUtilProgressBar -Label "Tweaks finished" -Percent 100
$sync.ProcessRunning = $false $sync.ProcessRunning = $false

View File

@ -4,6 +4,7 @@
{{ super() }} {{ super() }}
<div style="color: red; text-align: center; padding: 10px; font-size: 20px;"> <div style="color: red; text-align: center; padding: 10px; font-size: 20px;">
<strong>Announcement:</strong> We are currently not adding any applications to WinUtil and any apps that will be added through a PR will be declined by the maintainer. <strong>Announcement:</strong> We are currently not adding any applications to WinUtil and any apps that will be added through a PR will be declined by the maintainer.
<strong>Announcement:</strong> We are currently reworking the docs to use Hugo rather then mkdocs.
</div> </div>
{% endblock %} {% endblock %}

View File

@ -52,29 +52,6 @@ $sync.runspace.Open()
$inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window' $inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window'
$defaulttheme = '_default'
if ((Get-WinUtilToggleStatus WPFToggleDarkMode) -eq $True) {
if (Invoke-WinUtilGPU -eq $True) {
$ctttheme = 'Matrix'
} else {
$ctttheme = 'Dark'
}
} else {
$ctttheme = 'Classic'
}
$returnVal = Set-WinUtilUITheme -inputXML $inputXML -customThemeName $ctttheme -defaultThemeName $defaulttheme
if ($returnVal[0] -eq "") {
Write-Host "Failed to statically apply theming to xaml content using Set-WinUtilTheme, please check previous Error/Warning messages." -ForegroundColor Red
Write-Host "Quitting winutil..." -ForegroundColor Red
$sync.runspace.Dispose()
$sync.runspace.Close()
[System.GC]::Collect()
exit 1
}
$inputXML = $returnVal[0]
$ctttheme = $returnVal[1]
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework') [void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
[xml]$XAML = $inputXML [xml]$XAML = $inputXML
@ -104,6 +81,35 @@ if (-NOT ($readerOperationSuccessful)) {
exit 1 exit 1
} }
# Setup the Window to follow listen for windows Theme Change events and update the winutil theme
# throttle logic needed, because windows seems to send more than one theme change event per change
$lastThemeChangeTime = [datetime]::MinValue
$debounceInterval = [timespan]::FromSeconds(2)
$sync.Form.Add_Loaded({
$interopHelper = New-Object System.Windows.Interop.WindowInteropHelper $sync.Form
$hwndSource = [System.Windows.Interop.HwndSource]::FromHwnd($interopHelper.Handle)
$hwndSource.AddHook({
param (
[System.IntPtr]$hwnd,
[int]$msg,
[System.IntPtr]$wParam,
[System.IntPtr]$lParam,
[ref]$handled
)
# Check for the Event WM_SETTINGCHANGE (0x1001A) and validate that Button shows the icon for "Auto" => [char]0xF08C
if (($msg -eq 0x001A) -and $sync.ThemeButton.Content -eq [char]0xF08C) {
$currentTime = [datetime]::Now
if ($currentTime - $lastThemeChangeTime -gt $debounceInterval) {
Invoke-WinutilThemeChange -theme "Auto"
$script:lastThemeChangeTime = $currentTime
$handled = $true
}
}
return 0
})
})
Invoke-WinutilThemeChange -init $true
# Load the configuration files # Load the configuration files
#Invoke-WPFUIElements -configVariable $sync.configs.nav -targetGridName "WPFMainGrid" #Invoke-WPFUIElements -configVariable $sync.configs.nav -targetGridName "WPFMainGrid"
Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "appspanel" -columncount 5 Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "appspanel" -columncount 5
@ -248,24 +254,34 @@ $commonKeyEvents = {
$sync["Form"].Add_PreViewKeyDown($commonKeyEvents) $sync["Form"].Add_PreViewKeyDown($commonKeyEvents)
$sync["Form"].Add_MouseLeftButtonDown({ $sync["Form"].Add_MouseLeftButtonDown({
if ($sync["SettingsPopup"].IsOpen) { # Hide Settings and Theme Popup on click anywhere else
$sync["SettingsPopup"].IsOpen = $false if ($sync.SettingsButton.IsOpen -or
} $sync.ThemePopup.IsOpen) {
$sync.SettingsPopup.IsOpen = $false
$sync.ThemePopup.IsOpen = $false
}
$sync["Form"].DragMove() $sync["Form"].DragMove()
}) })
$sync["Form"].Add_MouseDoubleClick({ $sync["Form"].Add_MouseDoubleClick({
if ($sync["Form"].WindowState -eq [Windows.WindowState]::Normal) { if ($_.OriginalSource -is [System.Windows.Controls.Grid] -or
$sync["Form"].WindowState = [Windows.WindowState]::Maximized; $_.OriginalSource -is [System.Windows.Controls.StackPanel]) {
} else { if ($sync["Form"].WindowState -eq [Windows.WindowState]::Normal) {
$sync["Form"].WindowState = [Windows.WindowState]::Normal; $sync["Form"].WindowState = [Windows.WindowState]::Maximized
}
else{
$sync["Form"].WindowState = [Windows.WindowState]::Normal
}
} }
}) })
$sync["Form"].Add_Deactivated({ $sync["Form"].Add_Deactivated({
Write-Debug "WinUtil lost focus" Write-Debug "WinUtil lost focus"
if ($sync["SettingsPopup"].IsOpen) { # Hide Settings and Theme Popup on Winutil Focus Loss
$sync["SettingsPopup"].IsOpen = $false if ($sync.SettingsButton.IsOpen -or
$sync.ThemePopup.IsOpen) {
$sync.SettingsPopup.IsOpen = $false
$sync.ThemePopup.IsOpen = $false
} }
}) })
@ -383,6 +399,33 @@ Add-Type @"
}) })
# Add event handlers for the RadioButtons
$sync["ISOdownloader"].add_Checked({
$sync["ISORelease"].Visibility = [System.Windows.Visibility]::Visible
$sync["ISOLanguage"].Visibility = [System.Windows.Visibility]::Visible
})
$sync["ISOmanual"].add_Checked({
$sync["ISORelease"].Visibility = [System.Windows.Visibility]::Collapsed
$sync["ISOLanguage"].Visibility = [System.Windows.Visibility]::Collapsed
})
$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") {
$sync["ISOLanguage"].Items.Add("English International") | Out-Null
}
if ($currentCulture -ne "English") {
$sync["ISOLanguage"].Items.Add("English") | Out-Null
}
if ($sync["ISOLanguage"].Items.Count -eq 1) {
$sync["ISOLanguage"].IsEnabled = $false
}
$sync["ISOLanguage"].SelectedIndex = 0
# Load Checkboxes and Labels outside of the Filter function only once on startup for performance reasons # Load Checkboxes and Labels outside of the Filter function only once on startup for performance reasons
$filter = Get-WinUtilVariables -Type CheckBox $filter = Get-WinUtilVariables -Type CheckBox
$CheckBoxes = ($sync.GetEnumerator()).where{ $psitem.Key -in $filter } $CheckBoxes = ($sync.GetEnumerator()).where{ $psitem.Key -in $filter }
@ -405,8 +448,8 @@ $sync["SearchBar"].Add_TextChanged({
$textToSearch = $sync.SearchBar.Text.ToLower() $textToSearch = $sync.SearchBar.Text.ToLower()
foreach ($CheckBox in $CheckBoxes) { foreach ($CheckBox in $CheckBoxes) {
# Check if the checkbox is null or if it doesn't have content # Skip if the checkbox is null, it doesn't have content or it is the prefer Choco checkbox
if ($CheckBox -eq $null -or $CheckBox.Value -eq $null -or $CheckBox.Value.Content -eq $null) { if ($CheckBox -eq $null -or $CheckBox.Value -eq $null -or $CheckBox.Value.Content -eq $null -or $CheckBox.Name -eq "WPFpreferChocolatey") {
continue continue
} }
@ -416,7 +459,7 @@ $sync["SearchBar"].Add_TextChanged({
# Retrieve the corresponding text block based on the generated name # Retrieve the corresponding text block based on the generated name
$textBlock = $sync[$textBlockName] $textBlock = $sync[$textBlockName]
if ($CheckBox.Value.Content.ToLower().Contains($textToSearch)) { if ($CheckBox.Value.Content.ToString().ToLower().Contains($textToSearch)) {
$CheckBox.Value.Visibility = "Visible" $CheckBox.Value.Visibility = "Visible"
$activeApplications += $sync.configs.applications.$checkboxName $activeApplications += $sync.configs.applications.$checkboxName
# Set the corresponding text block visibility # Set the corresponding text block visibility
@ -478,15 +521,47 @@ Set-WinUtilTaskbaritem -overlay "logo"
$sync["Form"].Add_Activated({ $sync["Form"].Add_Activated({
Set-WinUtilTaskbaritem -overlay "logo" Set-WinUtilTaskbaritem -overlay "logo"
}) })
# Define event handler for ThemeButton click
$sync["ThemeButton"].Add_Click({
if ($sync.ThemePopup.IsOpen) {
$sync.ThemePopup.IsOpen = $false
}
else{
$sync.ThemePopup.IsOpen = $true
}
$sync.SettingsPopup.IsOpen = $false
})
# Define event handlers for menu items
$sync["AutoThemeMenuItem"].Add_Click({
$sync.ThemePopup.IsOpen = $false
Invoke-WinutilThemeChange -theme "Auto"
$_.Handled = $false
})
# Define event handlers for menu items
$sync["DarkThemeMenuItem"].Add_Click({
$sync.ThemePopup.IsOpen = $false
Invoke-WinutilThemeChange -theme "Dark"
$_.Handled = $false
})
# Define event handlers for menu items
$sync["LightThemeMenuItem"].Add_Click({
$sync.ThemePopup.IsOpen = $false
Invoke-WinutilThemeChange -theme "Light"
$_.Handled = $false
})
# Define event handler for button click # Define event handler for button click
$sync["SettingsButton"].Add_Click({ $sync["SettingsButton"].Add_Click({
Write-Debug "SettingsButton clicked" Write-Debug "SettingsButton clicked"
if ($sync["SettingsPopup"].IsOpen) { if ($sync.SettingsPopup.IsOpen) {
$sync["SettingsPopup"].IsOpen = $false $sync.SettingsPopup.IsOpen = $false
} else {
$sync["SettingsPopup"].IsOpen = $true
} }
else{
$sync.SettingsPopup.IsOpen = $true
}
$sync.ThemePopup.IsOpen = $false
$_.Handled = $false $_.Handled = $false
}) })
@ -518,12 +593,8 @@ MicroWin : <a href="https://github.com/KonTy">@KonTy</a>
GitHub : <a href="https://github.com/ChrisTitusTech/winutil">ChrisTitusTech/winutil</a> GitHub : <a href="https://github.com/ChrisTitusTech/winutil">ChrisTitusTech/winutil</a>
Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sync.version)">$($sync.version)</a> Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sync.version)">$($sync.version)</a>
"@ "@
$FontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSize
$HeaderFontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSizeHeader Show-CustomDialog -Message $authorInfo -LogoSize $LogoSize
$LogoSize = $sync.configs.themes.$ctttheme.CustomDialogLogoSize
$Width = $sync.configs.themes.$ctttheme.CustomDialogWidth
$Height = $sync.configs.themes.$ctttheme.CustomDialogHeight
Show-CustomDialog -Message $authorInfo -Width $Width -Height $Height -FontSize $FontSize -HeaderFontSize $HeaderFontSize -LogoSize $LogoSize
}) })
$sync["SponsorMenuItem"].Add_Click({ $sync["SponsorMenuItem"].Add_Click({
@ -544,12 +615,8 @@ $sync["SponsorMenuItem"].Add_Click({
$authorInfo += "An error occurred while fetching or processing the sponsors: $_`n" $authorInfo += "An error occurred while fetching or processing the sponsors: $_`n"
} }
$FontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSize Show-CustomDialog -Message $authorInfo -EnableScroll $true
$HeaderFontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSizeHeader
$LogoSize = $sync.configs.themes.$ctttheme.CustomDialogLogoSize
$Width = $sync.configs.themes.$ctttheme.CustomDialogWidth
$Height = $sync.configs.themes.$ctttheme.CustomDialogHeight
Show-CustomDialog -Message $authorInfo -Width $Width -Height $Height -FontSize $FontSize -HeaderFontSize $HeaderFontSize -LogoSize $LogoSize -EnableScroll $true
}) })
$sync["Form"].ShowDialog() | out-null $sync["Form"].ShowDialog() | out-null
Stop-Transcript Stop-Transcript

View File

@ -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." 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 $InternalExcludedFiles = [System.Collections.Generic.List[string]]::new($ExcludedFiles.Count)
ForEach ($excludedFile in $ExcludedFiles) {
# Make sure there's a * at the end of folders in ExcludedFiles list $InternalExcludedFiles.Add($excludedFile) | Out-Null
for ($i = 0; $i -lt $count; $i++) {
$excludedFile = $ExcludedFiles[$i]
$isFolder = ($excludedFile) -match '\\$'
if ($isFolder) { $ExcludedFiles[$i] = $excludedFile + '*' }
} }
# Validate the ExcludedFiles List before continuing on, # Validate the ExcludedItems List before continuing on,
# that's if there's a list in the first place, and '-SkipExcludedFilesValidation' was not provided. # that's if there's a list in the first place, and '-SkipInternalExcludedFilesValidation' was not provided.
if (-not $SkipExcludedFilesValidation) { if ($ExcludedFiles.Count -gt 0) {
for ($i = 0; $i -lt $count; $i++) { ForEach ($excludedFile in $ExcludedFiles) {
$excludedFile = $ExcludedFiles[$i]
$filePath = "$(($WorkingDir -replace ('\\$', '')) + '\' + ($excludedFile -replace ('\.\\', '')))" $filePath = "$(($WorkingDir -replace ('\\$', '')) + '\' + ($excludedFile -replace ('\.\\', '')))"
$files = Get-ChildItem -Recurse -Path "$filePath" -File -Force
# Handle paths with wildcards in a different implementation if ($files.Count -gt 0) {
$matches = ($filePath) -match '^.*?\*' ForEach ($file in $files) {
$InternalExcludedFiles.Add("$($file.FullName)") | Out-Null
if ($matches) {
if (-NOT (Get-ChildItem -Recurse -Path "$filePath" -File -Force)) {
$failedFilesList += "'$filePath', "
} }
} else { } else { $failedFilesList += "'$filePath', " }
if (-NOT (Test-Path -Path "$filePath")) {
$failedFilesList += "'$filePath', "
}
}
} }
$failedFilesList = $failedFilesList -replace (',\s*$', '') $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" 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 # Get Files List
[System.Collections.ArrayList]$files = Get-ChildItem $WorkingDir -Recurse -Exclude $ExcludedFiles -File -Force [System.Collections.ArrayList]$files = Get-ChildItem -LiteralPath $WorkingDir -Recurse -Exclude $InternalExcludedFiles -File -Force
$numOfFiles = $files.Count
# Only keep the 'FullName' Property for every entry in the list # 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] $file = $files[$i]
$files[$i] = $file.FullName $files[$i] = $file.FullName
} }
# If a file(s) are found in Exclude List, # If a file(s) are found in Exclude List,
# Remove the file from files list. # Remove the file from files list.
for ($j = 0; $j -lt $excludedFiles.Count; $j++) { ForEach ($excludedFile in $InternalExcludedFiles) {
# Prepare some variables $index = $files.IndexOf("$excludedFile")
$excluded = $excludedFiles[$j] if ($index -ge 0) { $files.RemoveAt($index) }
$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) }
}
} }
# 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 $numOfFiles = $files.Count
if ($numOfFiles -eq 0) { if ($numOfFiles -eq 0) {

File diff suppressed because it is too large Load Diff