mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-15 10:58:21 -05:00
Compare commits
201 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
18de3d59ee | ||
![]() |
59d968e7c4 | ||
![]() |
afe85ad7f0 | ||
![]() |
efb9e5bde6 | ||
![]() |
56eba47a6c | ||
![]() |
e57cde423c | ||
![]() |
de9b643129 | ||
![]() |
e430e0aad0 | ||
![]() |
61fd4d2f91 | ||
![]() |
b72cd83189 | ||
![]() |
290292ec94 | ||
![]() |
d22865d79b | ||
![]() |
5c5b999a09 | ||
![]() |
0c0e6bd243 | ||
![]() |
dd06489d63 | ||
![]() |
41df9d3d88 | ||
![]() |
63d56bcac9 | ||
![]() |
962b18e8fa | ||
![]() |
14e761f438 | ||
![]() |
3e416f5c14 | ||
![]() |
95d28ee25d | ||
![]() |
50071067b7 | ||
![]() |
3b7d707262 | ||
![]() |
ea95dac426 | ||
![]() |
b4d3368680 | ||
![]() |
0b5c44cbcf | ||
![]() |
b8b16be24b | ||
![]() |
14943e3c55 | ||
![]() |
91365d50b5 | ||
![]() |
82b6c268b0 | ||
![]() |
d8c007d2db | ||
![]() |
48f1c71584 | ||
![]() |
f770642a6a | ||
![]() |
963c0a17aa | ||
![]() |
20769f66a1 | ||
![]() |
86459b7e24 | ||
![]() |
89919494e5 | ||
![]() |
5f6bdb2e48 | ||
![]() |
f614eea435 | ||
![]() |
82447a1e7b | ||
![]() |
51424abfad | ||
![]() |
3caa3be9a3 | ||
![]() |
7769a328bb | ||
![]() |
425f11d787 | ||
![]() |
6df94df594 | ||
![]() |
29e2c4d197 | ||
![]() |
b63a17b7dd | ||
![]() |
abe059917c | ||
![]() |
698f1644c3 | ||
![]() |
fd03f33c50 | ||
![]() |
8f9e7d1b7c | ||
![]() |
b3dd1a1a50 | ||
![]() |
4acad32a38 | ||
![]() |
0f4fca31b9 | ||
![]() |
36c984b66c | ||
![]() |
d215d0fc2c | ||
![]() |
52de4690ab | ||
![]() |
ef97a8da24 | ||
![]() |
18a7f17a0b | ||
![]() |
5a8cf5deb6 | ||
![]() |
e4b2a38372 | ||
![]() |
94c5d89430 | ||
![]() |
8a0e0c7715 | ||
![]() |
1ae16f6f38 | ||
![]() |
6038556e64 | ||
![]() |
329a3de9a6 | ||
![]() |
f6e5d0e053 | ||
![]() |
364076c25e | ||
![]() |
a051e64a91 | ||
![]() |
dccda61ab4 | ||
![]() |
048f580a56 | ||
![]() |
bfb83ced79 | ||
![]() |
e2b37445f6 | ||
![]() |
c2fb98b0dc | ||
![]() |
cf8787a700 | ||
![]() |
53b723fa11 | ||
![]() |
32cb94f392 | ||
![]() |
5550e40270 | ||
![]() |
bcecf67c7d | ||
![]() |
3b50ff813c | ||
![]() |
eba5b35978 | ||
![]() |
254738a420 | ||
![]() |
bcc801683d | ||
![]() |
72c23823b2 | ||
![]() |
4e1ce7e417 | ||
![]() |
1dd0367417 | ||
![]() |
201f24c76e | ||
![]() |
9183e92692 | ||
![]() |
fa9dbcace4 | ||
![]() |
02f0f85c25 | ||
![]() |
83ae0579ba | ||
![]() |
5ebcacf404 | ||
![]() |
28bea518f0 | ||
![]() |
61c2e39ddb | ||
![]() |
0dfa9617fc | ||
![]() |
2ce4f54b80 | ||
![]() |
a05556a896 | ||
![]() |
985d415db1 | ||
![]() |
f4d4bdad3c | ||
![]() |
9d47514190 | ||
![]() |
4fc34e44b3 | ||
![]() |
c33946bde2 | ||
![]() |
4466720493 | ||
![]() |
1d0e3bfd5c | ||
![]() |
83450aef7b | ||
![]() |
e2ce998426 | ||
![]() |
cf7f161a06 | ||
![]() |
d6c1fbe4a2 | ||
![]() |
0779dd9096 | ||
![]() |
d48f212be4 | ||
![]() |
9c52f01204 | ||
![]() |
d49b21f881 | ||
![]() |
39ee4d53c0 | ||
![]() |
6e708bfe95 | ||
![]() |
e2b9586b0d | ||
![]() |
c418fe9030 | ||
![]() |
d619ee7e85 | ||
![]() |
bbc18b2d4b | ||
![]() |
9778c0d572 | ||
![]() |
8087a607fc | ||
![]() |
e5b79559bd | ||
![]() |
66e6aa7e96 | ||
![]() |
def47fe018 | ||
![]() |
b382f16ae8 | ||
![]() |
171441ddcf | ||
![]() |
7a0c40420e | ||
![]() |
0f0d9d0ae3 | ||
![]() |
6149738e6c | ||
![]() |
aa0b03feda | ||
![]() |
e0889d51db | ||
![]() |
ce1ef2a519 | ||
![]() |
77cb0a14c4 | ||
![]() |
c254a43f77 | ||
![]() |
640d2ca107 | ||
![]() |
c186642998 | ||
![]() |
47a4f1547e | ||
![]() |
1caf3111d3 | ||
![]() |
7dcdc4dbb7 | ||
![]() |
bfaba14191 | ||
![]() |
5640f9d04c | ||
![]() |
c6a832b006 | ||
![]() |
fe19094395 | ||
![]() |
fdd32f441f | ||
![]() |
e4565f1f6f | ||
![]() |
1404efab26 | ||
![]() |
1deb863f40 | ||
![]() |
de73efa868 | ||
![]() |
59097fc7e1 | ||
![]() |
207ce43428 | ||
![]() |
d92284ec83 | ||
![]() |
d855b08119 | ||
![]() |
0deac4ebb2 | ||
![]() |
c6fcf21dce | ||
![]() |
64ed00c2db | ||
![]() |
e165388117 | ||
![]() |
806cbd021a | ||
![]() |
869071783c | ||
![]() |
ae74965548 | ||
![]() |
b43d31088c | ||
![]() |
4fa1b0ddc7 | ||
![]() |
f012064574 | ||
![]() |
db26666f97 | ||
![]() |
38cf922572 | ||
![]() |
dd337be45e | ||
![]() |
3670c78789 | ||
![]() |
225e774f1e | ||
![]() |
0703935bfb | ||
![]() |
fd2ac35228 | ||
![]() |
f516c09ab3 | ||
![]() |
182fe09b64 | ||
![]() |
02751c706d | ||
![]() |
102231c0e3 | ||
![]() |
b9d7619f9b | ||
![]() |
4e39096b51 | ||
![]() |
662139ca5f | ||
![]() |
42febae25e | ||
![]() |
395ac9495d | ||
![]() |
6cc7d314fe | ||
![]() |
ba45c3303e | ||
![]() |
1f683d3f78 | ||
![]() |
18dff2af5e | ||
![]() |
377758758e | ||
![]() |
3f2759f967 | ||
![]() |
1ee7274bdb | ||
![]() |
06baebc60b | ||
![]() |
10917c159c | ||
![]() |
0251757fc0 | ||
![]() |
9136ed9802 | ||
![]() |
b3bbe0dbe5 | ||
![]() |
16b11e994b | ||
![]() |
a5a06c2a9b | ||
![]() |
81aead7a68 | ||
![]() |
a55a44a54c | ||
![]() |
9c0b0b8913 | ||
![]() |
7fe0f9a163 | ||
![]() |
8e5fcceddb | ||
![]() |
19a3c7070a | ||
![]() |
343a72f528 | ||
![]() |
0b13ca4b11 | ||
![]() |
215de06a58 | ||
![]() |
80555d945e |
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,26 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: 'bug'
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
## Describe the bug
|
||||
<!-- A clear and concise description of what the bug is. -->
|
||||
|
||||
## To Reproduce
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
## Expected behavior
|
||||
<!-- A clear and concise description of what you expected to happen. -->
|
||||
|
||||
## Screenshots
|
||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||
|
||||
## Additional context
|
||||
<!-- Add any other context about the problem here. -->
|
62
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
Normal file
62
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
name: "Bug report"
|
||||
description: "Report a bug to help us identify and fix issues in the project."
|
||||
labels: ["bug"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# 🐞 **Issue Report**
|
||||
Thank you for taking the time to report an issue! Please provide as much detail as possible to help us address the problem efficiently.
|
||||
|
||||
## ⚠️ **IMPORTANT**
|
||||
- 🛠️ **Supported environments only:** We only support Windows 11. Custom ISOs that are not made using Microwin are not supported.
|
||||
- 💡 For general questions, use the [Discussions section](https://github.com/Christitustech/winutil/discussions) or join our Community-driven [Discord Server](https://discord.gg/RUbZUZyByQ).
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: ⚙️ Issue Checklist
|
||||
options:
|
||||
- label: I have read the guidelines.
|
||||
- label: I checked for duplicate issues.
|
||||
- label: I searched for existing discussions.
|
||||
- label: I checked for an existing pull request that addresses this issue.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: affected_part
|
||||
attributes:
|
||||
label: 📜 What part of Winutil are you having issues with?
|
||||
placeholder: "e.g., Microwin, Tweaks, etc."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: issue_description
|
||||
attributes:
|
||||
label: 📝 Provide a clear and concise description of the issue.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: steps_to_reproduce
|
||||
attributes:
|
||||
label: 🔄 Steps to reproduce the issue.
|
||||
placeholder: "e.g., Step 1: ..., Step 2: ..."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: error_output
|
||||
attributes:
|
||||
label: ❌ Paste the full error output (if available).
|
||||
placeholder: "Include any relevant logs or error messages."
|
||||
|
||||
- type: textarea
|
||||
id: additional_context
|
||||
attributes:
|
||||
label: 🖼️ Additional context.
|
||||
placeholder: "Include screenshots, code blocks (use triple backticks ```), or any other relevant information."
|
||||
validations:
|
||||
required: false
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 💻 Community Discord
|
||||
url: https://discord.gg/RUbZUZyByQ
|
||||
about: Join our Community Discord server to chat with other users in the Winutil community.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: 'enhancement'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
|
||||
|
||||
**Describe the solution you'd like**
|
||||
<!-- A clear and concise description of what you want to happen. -->
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
|
||||
|
||||
**Additional context**
|
||||
<!-- Add any other context or screenshots about the feature request here. -->
|
57
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
Normal file
57
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
name: "Feature request"
|
||||
description: "Suggest a new feature or improvement for the project."
|
||||
labels: ["enhancement"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# ✨ **Feature request**
|
||||
Thank you for taking the time to suggest a feature! Please provide as much detail as possible to help us understand and evaluate your request.
|
||||
|
||||
## ⚠️ **IMPORTANT**
|
||||
- 🛠️ **Supported environments only:** We only support Windows 11.
|
||||
- 💡 For general questions, use the [Discussions section](https://github.com/Christitustech/winutil/discussions) or join our Community-driven [Discord Server](https://discord.gg/RUbZUZyByQ).
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: ⚙️ Issue Checklist
|
||||
options:
|
||||
- label: I have read the guidelines.
|
||||
- label: I checked for duplicate issues.
|
||||
- label: I searched for existing discussions.
|
||||
- label: I checked for an existing pull request that addresses this request.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: problem_statement
|
||||
attributes:
|
||||
label: ❓ Is your feature request related to a problem?
|
||||
placeholder: "Provide a clear and concise description of the issue you're facing. Example: 'I'm always frustrated when [...]'"
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: proposed_solution
|
||||
attributes:
|
||||
label: 💡 Describe the solution you'd like
|
||||
placeholder: "Provide a clear and concise description of what you want to happen."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: 🔄 Describe alternatives you've considered
|
||||
placeholder: "Provide details on any alternative solutions or features you've thought about."
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: additional_context
|
||||
attributes:
|
||||
label: 🖼️ Additional context
|
||||
placeholder: "Include screenshots, code blocks (use triple backticks ```), or any other relevant information."
|
||||
validations:
|
||||
required: false
|
5
.github/mkdocs.yml
vendored
5
.github/mkdocs.yml
vendored
@ -5,12 +5,15 @@ repo_url: https://github.com/ChrisTitusTech/winutil
|
||||
nav:
|
||||
- Introduction: 'index.md'
|
||||
- User Guide: 'userguide.md'
|
||||
- Contributing Guide: 'contribute.md'
|
||||
- Contributing Guide: 'CONTRIBUTING.md'
|
||||
- Documentation:
|
||||
- Dev Docs: 'devdocs.md'
|
||||
- Known Issues: 'KnownIssues.md'
|
||||
- FAQ: 'faq.md'
|
||||
|
||||
not_in_nav: |
|
||||
dev/
|
||||
|
||||
theme:
|
||||
name: material
|
||||
custom_dir: '../overrides'
|
||||
|
10
.github/release-drafter.yml
vendored
10
.github/release-drafter.yml
vendored
@ -1,6 +1,4 @@
|
||||
name-template: '$RESOLVED_VERSION'
|
||||
tag-template: '$RESOLVED_VERSION'
|
||||
tag-prefix: ""
|
||||
tag-prefix: ''
|
||||
categories:
|
||||
- title: '🚀 Features'
|
||||
labels:
|
||||
@ -21,10 +19,6 @@ template: |
|
||||
|
||||
$CHANGES
|
||||
|
||||
## Contributors
|
||||
|
||||
$CONTRIBUTORS
|
||||
|
||||
change-title-escapes: '\<*_&"'''
|
||||
autolabeler:
|
||||
- label: 'documentation'
|
||||
@ -56,3 +50,5 @@ replacers:
|
||||
replace: ''
|
||||
exclude-labels:
|
||||
- 'skip-changelog'
|
||||
|
||||
filter-by-commitish: true
|
||||
|
2
.github/requirements.txt
vendored
2
.github/requirements.txt
vendored
@ -15,7 +15,7 @@ gitdb==4.0.11
|
||||
GitPython==3.1.43
|
||||
htmlmin2==0.1.13
|
||||
idna==3.7
|
||||
Jinja2==3.1.4
|
||||
Jinja2==3.1.5
|
||||
jsmin==3.0.1
|
||||
Markdown==3.6
|
||||
MarkupSafe==2.1.5
|
||||
|
45
.github/workflows/close-issue-command.yaml
vendored
45
.github/workflows/close-issue-command.yaml
vendored
@ -1,45 +0,0 @@
|
||||
name: Close issue on /close
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created, edited]
|
||||
|
||||
jobs:
|
||||
closeIssueOnClose:
|
||||
# Skip this job if the comment was created/edited on a PR
|
||||
if: ${{ !github.event.issue.pull_request }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: none
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Check for /close comment
|
||||
id: check_comment
|
||||
run: |
|
||||
if [[ "${{ contains(github.event.comment.body, '/close') }}" == "true" ]]; then
|
||||
echo "comment=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "comment=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Check if the user is allowed
|
||||
id: check_user
|
||||
if: env.comment == 'true'
|
||||
run: |
|
||||
ALLOWED_USERS=("ChrisTitusTech" "og-mrk" "Marterich" "MyDrift-user" "Real-MullaC")
|
||||
if [[ " ${ALLOWED_USERS[@]} " =~ " ${{ github.event.comment.user.login }} " ]]; then
|
||||
echo "user=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "user=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Close issue if conditions are met
|
||||
if: env.comment == 'true' && env.user == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
run: |
|
||||
echo Closing the issue...
|
||||
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }}
|
4
.github/workflows/close-old-issues.yaml
vendored
4
.github/workflows/close-old-issues.yaml
vendored
@ -28,8 +28,8 @@ jobs:
|
||||
days-before-pr-stale: -1
|
||||
days-before-pr-close: -1
|
||||
# Sends a message for both the Stale and Close events of an issue.
|
||||
stale-issue-message: "This issue was marked as stale because it has been inactive for 7 days"
|
||||
close-issue-message: "This issue was closed because it has been inactive for 7 days since it was marked as stale"
|
||||
stale-issue-message: "This issue was marked as stale due to inactivity."
|
||||
close-issue-message: "This issue was closed after remaining stale without updates."
|
||||
# Increase this value if the project receives a lot of
|
||||
# PRs (yes.. apparently they're processed no matter what) & Issues.
|
||||
# Default value for it (according to the docs) is 30
|
||||
|
115
.github/workflows/issue-slash-commands.yaml
vendored
Normal file
115
.github/workflows/issue-slash-commands.yaml
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
name: Issue slash commands
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created, edited]
|
||||
|
||||
jobs:
|
||||
issueCommands:
|
||||
# Skip this job if the comment was created/edited on a PR
|
||||
if: ${{ !github.event.issue.pull_request }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: none
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- run: echo "command=false" >> $GITHUB_ENV
|
||||
|
||||
- name: Check for /label command
|
||||
id: check_label_command
|
||||
run: |
|
||||
if [[ "${{ contains(github.event.comment.body, '/label') }}" == "true" ]]; then
|
||||
echo "command=true" >> $GITHUB_ENV
|
||||
LABEL_NAME=$(echo "${{ github.event.comment.body }}" | awk -F"/label" '/\/label/ { match($2, /'\''([^'\'']*)'\''/, arr); if (arr[1] != "") print arr[1] }')
|
||||
echo "label_command=true" >> $GITHUB_ENV
|
||||
echo "label_name=${LABEL_NAME}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "label_command=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Check for /unlabel command
|
||||
id: check_unlabel_command
|
||||
run: |
|
||||
if [[ "${{ contains(github.event.comment.body, '/unlabel') }}" == "true" ]]; then
|
||||
echo "command=true" >> $GITHUB_ENV
|
||||
UNLABEL_NAME=$(echo "${{ github.event.comment.body }}" | awk -F"/unlabel" '/\/unlabel/ { match($2, /'\''([^'\'']*)'\''/, arr); if (arr[1] != "") print arr[1] }')
|
||||
echo "unlabel_command=true" >> $GITHUB_ENV
|
||||
echo "unlabel_name=${UNLABEL_NAME}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "unlabel_command=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Check for /close command
|
||||
id: check_close_command
|
||||
run: |
|
||||
if [[ "${{ contains(github.event.comment.body, '/close') }}" == "true" ]]; then
|
||||
echo "command=true" >> $GITHUB_ENV
|
||||
echo "close_command=true" >> $GITHUB_ENV
|
||||
echo "reopen_command=false" >> $GITHUB_ENV
|
||||
else
|
||||
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
|
||||
|
||||
- name: Check if the user is allowed
|
||||
id: check_user
|
||||
if: env.command == 'true'
|
||||
run: |
|
||||
ALLOWED_USERS=("ChrisTitusTech" "og-mrk" "Marterich" "MyDrift-user" "Real-MullaC" "CodingWonders")
|
||||
if [[ " ${ALLOWED_USERS[@]} " =~ " ${{ github.event.comment.user.login }} " ]]; then
|
||||
echo "user=true" >> $GITHUB_ENV
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
- name: Close issue
|
||||
if: env.close_command == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
run: |
|
||||
echo Closing the issue...
|
||||
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: env.reopen_command == '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 }}
|
||||
|
||||
- name: Label issue
|
||||
if: env.label_command == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
run: |
|
||||
echo Labeling the issue...
|
||||
gh issue edit $ISSUE_NUMBER --repo ${{ github.repository }} --add-label "${{ env.label_name }}"
|
||||
|
||||
- name: Remove labels
|
||||
if: env.unlabel_command == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
run: |
|
||||
echo Unlabeling the issue...
|
||||
gh issue edit $ISSUE_NUMBER --repo ${{ github.repository }} --remove-label "${{ env.unlabel_name }}"
|
31
.github/workflows/pre-release.yaml
vendored
31
.github/workflows/pre-release.yaml
vendored
@ -49,31 +49,6 @@ jobs:
|
||||
}
|
||||
shell: pwsh
|
||||
|
||||
- name: Create and import code signing certificate
|
||||
shell: pwsh
|
||||
run: |
|
||||
[System.IO.File]::WriteAllBytes("$env:USERPROFILE\code-signing-cert.pfx", [System.Convert]::FromBase64String("$env:CERTIFICATE_BASE64"))
|
||||
Import-PfxCertificate -FilePath "$env:USERPROFILE\code-signing-cert.pfx" -CertStoreLocation Cert:\CurrentUser\My
|
||||
|
||||
- name: Code sign winutil.ps1
|
||||
shell: pwsh
|
||||
run: |
|
||||
$cert = Get-ChildItem -Path Cert:\CurrentUser\My -CodeSigningCert | Select-Object -First 1
|
||||
if ($null -eq $cert) { throw "Code signing certificate not found" }
|
||||
Set-AuthenticodeSignature -FilePath ./winutil.ps1 -Certificate $cert
|
||||
|
||||
- name: Verify code signature
|
||||
shell: pwsh
|
||||
run: |
|
||||
$signature = Get-AuthenticodeSignature -FilePath ./winutil.ps1
|
||||
if ($signature.Status -ne 'Valid') { throw "Code signing failed" }
|
||||
|
||||
- name: Upload winutil.ps1 as artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: winutil
|
||||
path: ./winutil.ps1
|
||||
|
||||
- name: Generate Release Notes
|
||||
id: generate_notes
|
||||
uses: release-drafter/release-drafter@v6
|
||||
@ -81,14 +56,14 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
config-name: release-drafter.yml
|
||||
version: ${{ env.version }}
|
||||
version: ${{ env.VERSION }} # Pass the version variable
|
||||
|
||||
- name: Create and Upload Release
|
||||
id: create_release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ env.version }}
|
||||
name: Pre-Release ${{ env.version }}
|
||||
tag_name: ${{ env.VERSION }}
|
||||
name: Pre-Release ${{ env.VERSION }}
|
||||
body: |
|
||||
${{ steps.generate_notes.outputs.body }}
|
||||
|
||||
|
9
.gitignore
vendored
9
.gitignore
vendored
@ -2,6 +2,7 @@
|
||||
|
||||
# Configuration folder
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
### Visual Studio ###
|
||||
|
||||
@ -10,6 +11,9 @@
|
||||
|
||||
winutil.pdb
|
||||
|
||||
### Preprocessor Hashes ###
|
||||
.preprocessor_hashes.json
|
||||
|
||||
### Windows ###
|
||||
|
||||
# Folder config file
|
||||
@ -46,4 +50,7 @@ True
|
||||
test.ps1
|
||||
winutil.ps1
|
||||
|
||||
binary/
|
||||
# temporary excludes for docs
|
||||
.github/site/
|
||||
|
||||
binary/
|
||||
|
37
Compile.ps1
37
Compile.ps1
@ -1,7 +1,6 @@
|
||||
param (
|
||||
[switch]$Debug,
|
||||
[switch]$Run,
|
||||
[switch]$SkipPreprocessing,
|
||||
[string]$Arguments
|
||||
)
|
||||
|
||||
@ -45,17 +44,16 @@ $header = @"
|
||||
################################################################################################################
|
||||
"@
|
||||
|
||||
if (-NOT $SkipPreprocessing) {
|
||||
Update-Progress "Pre-req: Running Preprocessor..." 0
|
||||
|
||||
# Dot source the 'Invoke-Preprocessing' Function from 'tools/Invoke-Preprocessing.ps1' Script
|
||||
$preprocessingFilePath = ".\tools\Invoke-Preprocessing.ps1"
|
||||
. $preprocessingFilePath
|
||||
Update-Progress "Pre-req: Running Preprocessor..." 0
|
||||
|
||||
$excludedFiles = @('.\.git\', '.\.gitignore', '.\.gitattributes', '.\.github\CODEOWNERS', '.\LICENSE', "$preprocessingFilePath", '*.png', '*.exe')
|
||||
$msg = "Pre-req: Code Formatting"
|
||||
Invoke-Preprocessing -WorkingDir "$workingdir" -ExcludedFiles $excludedFiles -ProgressStatusMessage $msg -ThrowExceptionOnEmptyFilesList
|
||||
}
|
||||
# Dot source the 'Invoke-Preprocessing' Function from 'tools/Invoke-Preprocessing.ps1' Script
|
||||
$preprocessingFilePath = ".\tools\Invoke-Preprocessing.ps1"
|
||||
. $preprocessingFilePath
|
||||
|
||||
$excludedFiles = @('.\.git\', '.\.gitignore', '.\.gitattributes', '.\.github\CODEOWNERS', '.\LICENSE', "$preprocessingFilePath", '*.png', '*.exe','.\.preprocessor_hashes.json')
|
||||
$msg = "Pre-req: Code Formatting"
|
||||
Invoke-Preprocessing -WorkingDir "$workingdir" -ExcludedFiles $excludedFiles -ProgressStatusMessage $msg
|
||||
|
||||
# Create the script in memory.
|
||||
Update-Progress "Pre-req: Allocating Memory" 0
|
||||
@ -73,8 +71,8 @@ Get-ChildItem "functions" -Recurse -File | ForEach-Object {
|
||||
}
|
||||
Update-Progress "Adding: Config *.json" 40
|
||||
Get-ChildItem "config" | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object {
|
||||
$json = (Get-Content $psitem.FullName).replace("'","''")
|
||||
$jsonAsObject = $json | convertfrom-json
|
||||
$json = (Get-Content $psitem.FullName -Raw)
|
||||
$jsonAsObject = $json | ConvertFrom-Json
|
||||
|
||||
# Add 'WPFInstall' as a prefix to every entry-name in 'applications.json' file
|
||||
if ($psitem.Name -eq "applications.json") {
|
||||
@ -85,12 +83,13 @@ Get-ChildItem "config" | Where-Object {$psitem.extension -eq ".json"} | ForEach-
|
||||
}
|
||||
}
|
||||
|
||||
# The replace at the end is required, as without it the output of 'converto-json' will be somewhat weird for Multiline Strings
|
||||
# Most Notably is the scripts in some json files, making it harder for users who want to review these scripts, which're found in the compiled script
|
||||
$json = ($jsonAsObject | convertto-json -Depth 3).replace('\r\n',"`r`n")
|
||||
# Line 90 requires no whitespace inside the here-strings, to keep formatting of the JSON in the final script.
|
||||
$json = @"
|
||||
$($jsonAsObject | ConvertTo-Json -Depth 3)
|
||||
"@
|
||||
|
||||
$sync.configs.$($psitem.BaseName) = $json | convertfrom-json
|
||||
$script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$json' `| convertfrom-json" ))
|
||||
$sync.configs.$($psitem.BaseName) = $json | ConvertFrom-Json
|
||||
$script_content.Add($(Write-Output "`$sync.configs.$($psitem.BaseName) = @'`r`n$json`r`n'@ `| ConvertFrom-Json" ))
|
||||
}
|
||||
|
||||
# Read the entire XAML file as a single string, preserving line breaks
|
||||
@ -124,10 +123,12 @@ Write-Progress -Activity "Compiling" -Completed
|
||||
|
||||
Update-Progress -Activity "Validating" -StatusMessage "Checking winutil.ps1 Syntax" -Percent 0
|
||||
try {
|
||||
$null = Get-Command -Syntax .\winutil.ps1
|
||||
Get-Command -Syntax .\winutil.ps1 | Out-Null
|
||||
} catch {
|
||||
Write-Warning "Syntax Validation for 'winutil.ps1' has failed"
|
||||
Write-Host "$($Error[0])" -ForegroundColor Red
|
||||
Pop-Location # Restore previous location before exiting...
|
||||
exit 1
|
||||
}
|
||||
Write-Progress -Activity "Validating" -Completed
|
||||
|
||||
|
16
Test-WingetInstall.ps1
Normal file
16
Test-WingetInstall.ps1
Normal file
@ -0,0 +1,16 @@
|
||||
# Import the function (adjust the path according to your setup)
|
||||
. "./functions/private/Install-WinUtilWinget.ps1"
|
||||
. "./functions/private/Test-WinUtilPackageManager.ps1"
|
||||
|
||||
# Set up Information stream to be visible
|
||||
$InformationPreference = "Continue"
|
||||
|
||||
Write-Host "Starting Winget installation test..." -ForegroundColor Cyan
|
||||
|
||||
try {
|
||||
Install-WinUtilWinget
|
||||
} catch {
|
||||
Write-Host "Error occurred during testing: $($_.Exception.Message)" -ForegroundColor Red
|
||||
Write-Host "Stack Trace:" -ForegroundColor Red
|
||||
$_.ScriptStackTrace
|
||||
}
|
@ -349,7 +349,7 @@
|
||||
"content": "Display Driver Uninstaller",
|
||||
"description": "Display Driver Uninstaller (DDU) is a tool for completely uninstalling graphics drivers from NVIDIA, AMD, and Intel. It is useful for troubleshooting graphics driver-related issues.",
|
||||
"link": "https://www.wagnardsoft.com/display-driver-uninstaller-DDU-",
|
||||
"winget": "ddu"
|
||||
"winget": "Wagnardsoft.DisplayDriverUninstaller"
|
||||
},
|
||||
"deluge": {
|
||||
"category": "Utilities",
|
||||
@ -439,13 +439,21 @@
|
||||
"link": "https://dotnet.microsoft.com/download/dotnet/8.0",
|
||||
"winget": "Microsoft.DotNet.DesktopRuntime.8"
|
||||
},
|
||||
"dotnet9": {
|
||||
"category": "Microsoft Tools",
|
||||
"choco": "dotnet-9.0-runtime",
|
||||
"content": ".NET Desktop Runtime 9",
|
||||
"description": ".NET Desktop Runtime 9 is a runtime environment required for running applications developed with .NET 9.",
|
||||
"link": "https://dotnet.microsoft.com/download/dotnet/9.0",
|
||||
"winget": "Microsoft.DotNet.DesktopRuntime.9"
|
||||
},
|
||||
"dmt": {
|
||||
"winget": "GNE.DualMonitorTools",
|
||||
"choco": "dual-monitor-tools",
|
||||
"category": "Utilities",
|
||||
"content": "Dual Monitor Tools",
|
||||
"link": "https://dualmonitortool.sourceforge.net/",
|
||||
"description": "Dual Monitor Tools (DMT) is a FOSS app that customize handling multiple monitors and even lock the mouse on specific monitor. Useful for full screen games and apps that does not handle well a second monitor or helps the workflow."
|
||||
"description": "Dual Monitor Tools (DMT) is a FOSS app that allows you to customize the handling of multiple monitors. Useful for fullscreen games and apps that handle a second monitor poorly and can improve your workflow."
|
||||
},
|
||||
"duplicati": {
|
||||
"category": "Utilities",
|
||||
@ -519,14 +527,6 @@
|
||||
"link": "https://espanso.org/",
|
||||
"winget": "Espanso.Espanso"
|
||||
},
|
||||
"etcher": {
|
||||
"category": "Utilities",
|
||||
"choco": "etcher",
|
||||
"content": "Etcher USB Creator",
|
||||
"description": "Etcher is a powerful tool for creating bootable USB drives with ease.",
|
||||
"link": "https://www.balena.io/etcher/",
|
||||
"winget": "Balena.Etcher"
|
||||
},
|
||||
"falkon": {
|
||||
"category": "Browsers",
|
||||
"choco": "falkon",
|
||||
@ -675,9 +675,9 @@
|
||||
"category": "Multimedia Tools",
|
||||
"choco": "fxsound",
|
||||
"content": "FxSound",
|
||||
"description": "FxSound is a cutting-edge audio enhancement software that elevates your listening experience across all media.",
|
||||
"description": "FxSound is free open-source software to boost sound quality, volume, and bass. Including an equalizer, effects, and presets for customized audio.",
|
||||
"link": "https://www.fxsound.com/",
|
||||
"winget": "FxSoundLLC.FxSound"
|
||||
"winget": "FxSound.FxSound"
|
||||
},
|
||||
"fzf": {
|
||||
"category": "Utilities",
|
||||
@ -701,7 +701,7 @@
|
||||
"content": "GIMP (Image Editor)",
|
||||
"description": "GIMP is a versatile open-source raster graphics editor used for tasks such as photo retouching, image editing, and image composition.",
|
||||
"link": "https://www.gimp.org/",
|
||||
"winget": "GIMP.GIMP"
|
||||
"winget": "GIMP.GIMP.3"
|
||||
},
|
||||
"git": {
|
||||
"category": "Development",
|
||||
@ -908,7 +908,7 @@
|
||||
"choco": "imgburn",
|
||||
"content": "ImgBurn",
|
||||
"description": "ImgBurn is a lightweight CD, DVD, HD-DVD, and Blu-ray burning application with advanced features for creating and burning disc images.",
|
||||
"link": "http://www.imgburn.com/",
|
||||
"link": "https://www.imgburn.com/",
|
||||
"winget": "LIGHTNINGUK.ImgBurn"
|
||||
},
|
||||
"inkscape": {
|
||||
@ -980,7 +980,7 @@
|
||||
"choco": "jdownloader",
|
||||
"content": "JDownloader",
|
||||
"description": "JDownloader is a feature-rich download manager with support for various file hosting services.",
|
||||
"link": "http://jdownloader.org/",
|
||||
"link": "https://jdownloader.org/",
|
||||
"winget": "AppWork.JDownloader"
|
||||
},
|
||||
"jellyfinmediaplayer": {
|
||||
@ -1372,7 +1372,7 @@
|
||||
"choco": "na",
|
||||
"content": "nGlide (3dfx compatibility)",
|
||||
"description": "nGlide is a 3Dfx Voodoo Glide wrapper. It allows you to play games that use Glide API on modern graphics cards without the need for a 3Dfx Voodoo graphics card.",
|
||||
"link": "http://www.zeus-software.com/downloads/nglide",
|
||||
"link": "https://www.zeus-software.com/downloads/nglide",
|
||||
"winget": "ZeusSoftware.nGlide"
|
||||
},
|
||||
"nmap": {
|
||||
@ -1503,14 +1503,6 @@
|
||||
"link": "https://github.com/namazso/OpenHashTab/",
|
||||
"winget": "namazso.OpenHashTab"
|
||||
},
|
||||
"openoffice": {
|
||||
"category": "Document",
|
||||
"choco": "openoffice",
|
||||
"content": "Apache OpenOffice",
|
||||
"description": "Apache OpenOffice is an open-source office software suite for word processing, spreadsheets, presentations, and more.",
|
||||
"link": "https://www.openoffice.org/",
|
||||
"winget": "Apache.OpenOffice"
|
||||
},
|
||||
"openrgb": {
|
||||
"category": "Utilities",
|
||||
"choco": "openrgb",
|
||||
@ -1691,7 +1683,7 @@
|
||||
"category": "Games",
|
||||
"choco": "prismlauncher",
|
||||
"content": "Prism Launcher",
|
||||
"description": "Prism Launcher is a game launcher and manager designed to provide a clean and intuitive interface for organizing and launching your games.",
|
||||
"description": "Prism Launcher is an Open Source Minecraft launcher with the ability to manage multiple instances, accounts and mods.",
|
||||
"link": "https://prismlauncher.org/",
|
||||
"winget": "PrismLauncher.PrismLauncher"
|
||||
},
|
||||
@ -1871,14 +1863,6 @@
|
||||
"link": "https://sagethumbs.en.lo4d.com/windows",
|
||||
"winget": "CherubicSoftware.SageThumbs"
|
||||
},
|
||||
"samsungmagician": {
|
||||
"category": "Utilities",
|
||||
"choco": "samsung-magician",
|
||||
"content": "Samsung Magician",
|
||||
"description": "Samsung Magician is a utility for managing and optimizing Samsung SSDs.",
|
||||
"link": "https://semiconductor.samsung.com/consumer-storage/magician/",
|
||||
"winget": "Samsung.SamsungMagician"
|
||||
},
|
||||
"sandboxie": {
|
||||
"category": "Utilities",
|
||||
"choco": "sandboxie",
|
||||
@ -1892,7 +1876,7 @@
|
||||
"choco": "sdio",
|
||||
"content": "Snappy Driver Installer Origin",
|
||||
"description": "Snappy Driver Installer Origin is a free and open-source driver updater with a vast driver database for Windows.",
|
||||
"link": "https://sourceforge.net/projects/snappy-driver-installer-origin",
|
||||
"link": "https://www.glenn.delahoy.com/snappy-driver-installer-origin/",
|
||||
"winget": "GlennDelahoy.SnappyDriverInstallerOrigin"
|
||||
},
|
||||
"session": {
|
||||
@ -1991,14 +1975,6 @@
|
||||
"link": "http://www.uderzo.it/main_products/space_sniffer/",
|
||||
"winget": "UderzoSoftware.SpaceSniffer"
|
||||
},
|
||||
"spotube": {
|
||||
"category": "Multimedia Tools",
|
||||
"choco": "spotube",
|
||||
"content": "Spotube",
|
||||
"description": "Open source Spotify client that doesn't require Premium nor uses Electron! Available for both desktop & mobile! ",
|
||||
"link": "https://github.com/KRTirtho/spotube",
|
||||
"winget": "KRTirtho.Spotube"
|
||||
},
|
||||
"starship": {
|
||||
"category": "Development",
|
||||
"choco": "starship",
|
||||
@ -2196,7 +2172,7 @@
|
||||
"choco": "na",
|
||||
"content": "Thorium Browser AVX2",
|
||||
"description": "Browser built for speed over vanilla chromium. It is built with AVX2 optimizations and is the fastest browser on the market.",
|
||||
"link": "http://thorium.rocks/",
|
||||
"link": "https://thorium.rocks/",
|
||||
"winget": "Alex313031.Thorium.AVX2"
|
||||
},
|
||||
"thunderbird": {
|
||||
@ -2453,7 +2429,7 @@
|
||||
"content": "UniGetUI",
|
||||
"description": "UniGetUI is a GUI for Winget, Chocolatey, and other Windows CLI package managers.",
|
||||
"link": "https://www.marticliment.com/wingetui/",
|
||||
"winget": "SomePythonThings.WingetUIStore"
|
||||
"winget": "MartiCliment.UniGetUI"
|
||||
},
|
||||
"winmerge": {
|
||||
"category": "Document",
|
||||
@ -2855,14 +2831,6 @@
|
||||
"link": "https://www.kicad.org/",
|
||||
"winget": "KiCad.KiCad"
|
||||
},
|
||||
"FormatFactory": {
|
||||
"category": "Utilities",
|
||||
"choco": "formatfactory",
|
||||
"content": "Format Factory",
|
||||
"description":"FormatFactory is an ad-supported freeware multimedia converter that can convert video, audio, and picture files. It is also capable of ripping DVDs and CDs to other file formats, as well as creating .iso images. It can also join multiple video files together into one.",
|
||||
"link": "http://www.pcfreetime.com/formatfactory/",
|
||||
"winget": "na"
|
||||
},
|
||||
"dropox": {
|
||||
"category": "Utilities",
|
||||
"choco": "na",
|
||||
@ -2934,5 +2902,13 @@
|
||||
"description": "Fork - a fast and friendly git client.",
|
||||
"link": "https://git-fork.com/",
|
||||
"winget": "Fork.Fork"
|
||||
},
|
||||
"ZenBrowser": {
|
||||
"category": "Browsers",
|
||||
"choco": "na",
|
||||
"content": "Zen Browser",
|
||||
"description": "The modern, privacy-focused, performance-driven browser built on Firefox",
|
||||
"link": "https://zen-browser.app/",
|
||||
"winget": "Zen-Team.Zen-Browser"
|
||||
}
|
||||
}
|
||||
|
62
config/appnavigation.json
Normal file
62
config/appnavigation.json
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"WPFInstall": {
|
||||
"Content": "Install/Upgrade Applications",
|
||||
"Category": "____Actions",
|
||||
"Type": "Button",
|
||||
"Order": "1",
|
||||
"Description": "Install or upgrade the selected applications"
|
||||
},
|
||||
"WPFUninstall": {
|
||||
"Content": "Uninstall Applications",
|
||||
"Category": "____Actions",
|
||||
"Type": "Button",
|
||||
"Order": "2",
|
||||
"Description": "Uninstall the selected applications"
|
||||
},
|
||||
"WPFInstallUpgrade": {
|
||||
"Content": "Upgrade all Applications",
|
||||
"Category": "____Actions",
|
||||
"Type": "Button",
|
||||
"Order": "3",
|
||||
"Description": "Upgrade all applications to the latest version"
|
||||
},
|
||||
"WingetRadioButton": {
|
||||
"Content": "Winget",
|
||||
"Category": "__Package Manager",
|
||||
"Type": "RadioButton",
|
||||
"GroupName": "PackageManagerGroup",
|
||||
"Checked": true,
|
||||
"Order": "1",
|
||||
"Description": "Use Winget for package management"
|
||||
},
|
||||
"ChocoRadioButton": {
|
||||
"Content": "Chocolatey",
|
||||
"Category": "__Package Manager",
|
||||
"Type": "RadioButton",
|
||||
"GroupName": "PackageManagerGroup",
|
||||
"Checked": false,
|
||||
"Order": "2",
|
||||
"Description": "Use Chocolatey for package management"
|
||||
},
|
||||
"WPFClearInstallSelection": {
|
||||
"Content": "Clear Selection",
|
||||
"Category": "__Selection",
|
||||
"Type": "Button",
|
||||
"Order": "1",
|
||||
"Description": "Clear the selection of applications"
|
||||
},
|
||||
"WPFGetInstalled": {
|
||||
"Content": "Get Installed",
|
||||
"Category": "__Selection",
|
||||
"Type": "Button",
|
||||
"Order": "2",
|
||||
"Description": "Show installed applications"
|
||||
},
|
||||
"WPFselectedAppsButton": {
|
||||
"Content": "Selected Apps: 0",
|
||||
"Category": "__Selection",
|
||||
"Type": "Button",
|
||||
"Order": "3",
|
||||
"Description": "Show the selected applications"
|
||||
}
|
||||
}
|
@ -113,7 +113,7 @@
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>19</Order>
|
||||
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\remove-packages.ps1' -Raw | Invoke-Expression;"</Path>
|
||||
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\Microwin-RemovePackages.ps1' -Raw | Invoke-Expression;"</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>20</Order>
|
||||
@ -312,7 +312,7 @@ foreach( $file in $Document.unattend.Extensions.File ) {
|
||||
[System.IO.File]::WriteAllBytes( $path, ( $encoding.GetPreamble() + $encoding.GetBytes( $file.InnerText.Trim() ) ) );
|
||||
}
|
||||
</ExtractScript>
|
||||
<File path="C:\Windows\Temp\remove-packages.ps1">
|
||||
<File path="C:\Windows\Temp\Microwin-RemovePackages.ps1">
|
||||
$selectors = @(
|
||||
'Microsoft.Microsoft3DViewer';
|
||||
'Microsoft.BingSearch';
|
||||
@ -359,7 +359,7 @@ $removeCommand = {
|
||||
}
|
||||
};
|
||||
$type = 'Package';
|
||||
$logfile = 'C:\Windows\Temp\remove-packages.log';
|
||||
$logfile = 'C:\Windows\Temp\Microwin-RemovePackages.log';
|
||||
& {
|
||||
$installed = & $getCommand;
|
||||
foreach( $selector in $selectors ) {
|
||||
|
@ -46,5 +46,23 @@
|
||||
"Secondary": "94.140.15.16",
|
||||
"Primary6": "2a10:50c0::bad1:ff",
|
||||
"Secondary6": "2a10:50c0::bad2:ff"
|
||||
},
|
||||
"dns0.eu_Open":{
|
||||
"Primary": "193.110.81.254",
|
||||
"Secondary": "185.253.5.254",
|
||||
"Primary6": "2a0f:fc80::ffff",
|
||||
"Secondary6": "2a0f:fc81::ffff"
|
||||
},
|
||||
"dns0.eu_ZERO":{
|
||||
"Primary": "193.110.81.9",
|
||||
"Secondary": "185.253.5.9",
|
||||
"Primary6": "2a0f:fc80::9",
|
||||
"Secondary6": "2a0f:fc81::9"
|
||||
},
|
||||
"dns0.eu_KIDS":{
|
||||
"Primary": "193.110.81.1",
|
||||
"Secondary": "185.253.5.1",
|
||||
"Primary6": "2a0f:fc80::1",
|
||||
"Secondary6": "2a0f:fc81::1"
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
"NetFx3"
|
||||
],
|
||||
"InvokeScript": [],
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Features/dotnet"
|
||||
"link": "https://winutil.christitus.com/dev/features/features/dotnet"
|
||||
},
|
||||
"WPFFeatureshyperv": {
|
||||
"Content": "HyperV Virtualization",
|
||||
@ -31,7 +31,7 @@
|
||||
"InvokeScript": [
|
||||
"Start-Process -FilePath cmd.exe -ArgumentList '/c bcdedit /set hypervisorschedulertype classic' -Wait"
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Features/hyperv"
|
||||
"link": "https://winutil.christitus.com/dev/features/features/hyperv"
|
||||
},
|
||||
"WPFFeatureslegacymedia": {
|
||||
"Content": "Legacy Media (WMP, DirectPlay)",
|
||||
@ -46,7 +46,7 @@
|
||||
"LegacyComponents"
|
||||
],
|
||||
"InvokeScript": [],
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Features/legacymedia"
|
||||
"link": "https://winutil.christitus.com/dev/features/features/legacymedia"
|
||||
},
|
||||
"WPFFeaturewsl": {
|
||||
"Content": "Windows Subsystem for Linux",
|
||||
@ -59,7 +59,7 @@
|
||||
"Microsoft-Windows-Subsystem-Linux"
|
||||
],
|
||||
"InvokeScript": [],
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Features/wsl"
|
||||
"link": "https://winutil.christitus.com/dev/features/features/wsl"
|
||||
},
|
||||
"WPFFeaturenfs": {
|
||||
"Content": "NFS - Network File System",
|
||||
@ -79,7 +79,7 @@
|
||||
"nfsadmin client start",
|
||||
"nfsadmin client localhost config fileaccess=755 SecFlavors=+sys -krb5 -krb5i"
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Features/nfs"
|
||||
"link": "https://winutil.christitus.com/dev/features/features/nfs"
|
||||
},
|
||||
"WPFFeatureEnableSearchSuggestions": {
|
||||
"Content": "Enable Search Box Web Suggestions in Registry(explorer restart)",
|
||||
@ -97,7 +97,7 @@
|
||||
Stop-Process -name explorer -force
|
||||
"
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Features/EnableSearchSuggestions"
|
||||
"link": "https://winutil.christitus.com/dev/features/features/enablesearchsuggestions"
|
||||
},
|
||||
"WPFFeatureDisableSearchSuggestions": {
|
||||
"Content": "Disable Search Box Web Suggestions in Registry(explorer restart)",
|
||||
@ -115,7 +115,7 @@
|
||||
Stop-Process -name explorer -force
|
||||
"
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Features/DisableSearchSuggestions"
|
||||
"link": "https://winutil.christitus.com/dev/features/features/disablesearchsuggestions"
|
||||
},
|
||||
"WPFFeatureRegBackup": {
|
||||
"Content": "Enable Daily Registry Backup Task 12.30am",
|
||||
@ -133,7 +133,7 @@
|
||||
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName 'AutoRegBackup' -Description 'Create System Registry Backups' -User 'System'
|
||||
"
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Features/RegBackup"
|
||||
"link": "https://winutil.christitus.com/dev/features/features/regbackup"
|
||||
},
|
||||
"WPFFeatureEnableLegacyRecovery": {
|
||||
"Content": "Enable Legacy F8 Boot Recovery",
|
||||
@ -151,7 +151,7 @@
|
||||
Start-Process -FilePath cmd.exe -ArgumentList '/c bcdedit /Set {Current} BootMenuPolicy Legacy' -Wait
|
||||
"
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Features/EnableLegacyRecovery"
|
||||
"link": "https://winutil.christitus.com/dev/features/features/enablelegacyrecovery"
|
||||
},
|
||||
"WPFFeatureDisableLegacyRecovery": {
|
||||
"Content": "Disable Legacy F8 Boot Recovery",
|
||||
@ -169,7 +169,7 @@
|
||||
Start-Process -FilePath cmd.exe -ArgumentList '/c bcdedit /Set {Current} BootMenuPolicy Standard' -Wait
|
||||
"
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Features/DisableLegacyRecovery"
|
||||
"link": "https://winutil.christitus.com/dev/features/features/disablelegacyrecovery"
|
||||
},
|
||||
"WPFFeaturesSandbox": {
|
||||
"Content": "Windows Sandbox",
|
||||
@ -177,7 +177,7 @@
|
||||
"panel": "1",
|
||||
"Order": "a021_",
|
||||
"Description": "Windows Sandbox is a lightweight virtual machine that provides a temporary desktop environment to safely run applications and programs in isolation.",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Features/Sandbox"
|
||||
"link": "https://winutil.christitus.com/dev/features/features/sandbox"
|
||||
},
|
||||
"WPFFeatureInstall": {
|
||||
"Content": "Install Features",
|
||||
@ -186,7 +186,7 @@
|
||||
"Order": "a060_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Features/Install"
|
||||
"link": "https://winutil.christitus.com/dev/features/features/install"
|
||||
},
|
||||
"WPFPanelAutologin": {
|
||||
"Content": "Set Up Autologin",
|
||||
@ -195,7 +195,7 @@
|
||||
"panel": "1",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Fixes/Autologin"
|
||||
"link": "https://winutil.christitus.com/dev/features/fixes/autologin"
|
||||
},
|
||||
"WPFFixesUpdate": {
|
||||
"Content": "Reset Windows Update",
|
||||
@ -204,7 +204,7 @@
|
||||
"Order": "a041_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Fixes/Update"
|
||||
"link": "https://winutil.christitus.com/dev/features/fixes/update"
|
||||
},
|
||||
"WPFFixesNetwork": {
|
||||
"Content": "Reset Network",
|
||||
@ -213,7 +213,7 @@
|
||||
"panel": "1",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Fixes/Network"
|
||||
"link": "https://winutil.christitus.com/dev/features/fixes/network"
|
||||
},
|
||||
"WPFPanelDISM": {
|
||||
"Content": "System Corruption Scan",
|
||||
@ -222,7 +222,7 @@
|
||||
"Order": "a043_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Fixes/DISM"
|
||||
"link": "https://winutil.christitus.com/dev/features/fixes/dism"
|
||||
},
|
||||
"WPFFixesWinget": {
|
||||
"Content": "WinGet Reinstall",
|
||||
@ -231,7 +231,7 @@
|
||||
"Order": "a044_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Fixes/Winget"
|
||||
"link": "https://winutil.christitus.com/dev/features/fixes/winget"
|
||||
},
|
||||
"WPFRunAdobeCCCleanerTool": {
|
||||
"Content": "Remove Adobe Creative Cloud",
|
||||
@ -240,7 +240,7 @@
|
||||
"Order": "a045_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Fixes/RunAdobeCCCleanerTool"
|
||||
"link": "https://winutil.christitus.com/dev/features/fixes/runadobecccleanertool"
|
||||
},
|
||||
"WPFPanelnetwork": {
|
||||
"Content": "Network Connections",
|
||||
@ -248,7 +248,7 @@
|
||||
"panel": "2",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Legacy-Windows-Panels/network"
|
||||
"link": "https://winutil.christitus.com/dev/features/legacy-windows-panels/network"
|
||||
},
|
||||
"WPFPanelcontrol": {
|
||||
"Content": "Control Panel",
|
||||
@ -256,7 +256,7 @@
|
||||
"panel": "2",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Legacy-Windows-Panels/control"
|
||||
"link": "https://winutil.christitus.com/dev/features/legacy-windows-panels/control"
|
||||
},
|
||||
"WPFPanelpower": {
|
||||
"Content": "Power Panel",
|
||||
@ -264,7 +264,7 @@
|
||||
"panel": "2",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Legacy-Windows-Panels/power"
|
||||
"link": "https://winutil.christitus.com/dev/features/legacy-windows-panels/power"
|
||||
},
|
||||
"WPFPanelregion": {
|
||||
"Content": "Region",
|
||||
@ -272,7 +272,7 @@
|
||||
"panel": "2",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Legacy-Windows-Panels/region"
|
||||
"link": "https://winutil.christitus.com/dev/features/legacy-windows-panels/region"
|
||||
},
|
||||
"WPFPanelsound": {
|
||||
"Content": "Sound Settings",
|
||||
@ -280,7 +280,7 @@
|
||||
"panel": "2",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Legacy-Windows-Panels/sound"
|
||||
"link": "https://winutil.christitus.com/dev/features/legacy-windows-panels/sound"
|
||||
},
|
||||
"WPFPanelprinter": {
|
||||
"Content": "Printer Panel",
|
||||
@ -288,7 +288,7 @@
|
||||
"panel": "2",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Legacy-Windows-Panels/printer"
|
||||
"link": "https://winutil.christitus.com/dev/features/legacy-windows-panels/printer"
|
||||
},
|
||||
"WPFPanelsystem": {
|
||||
"Content": "System Properties",
|
||||
@ -296,7 +296,7 @@
|
||||
"panel": "2",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Legacy-Windows-Panels/system"
|
||||
"link": "https://winutil.christitus.com/dev/features/legacy-windows-panels/system"
|
||||
},
|
||||
"WPFPaneluser": {
|
||||
"Content": "User Accounts",
|
||||
@ -304,14 +304,37 @@
|
||||
"panel": "2",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Legacy-Windows-Panels/user"
|
||||
"link": "https://winutil.christitus.com/dev/features/legacy-windows-panels/user"
|
||||
},
|
||||
"WPFWinUtilPSProfile": {
|
||||
"WPFPanelGodMode": {
|
||||
"Content": "God Mode",
|
||||
"category": "Legacy Windows Panels",
|
||||
"panel": "2",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300"
|
||||
},
|
||||
"WPFWinUtilInstallPSProfile": {
|
||||
"Content": "Install CTT PowerShell Profile",
|
||||
"category": "Powershell Profile",
|
||||
"panel": "2",
|
||||
"Order": "a083_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300"
|
||||
},
|
||||
"WPFWinUtilUninstallPSProfile": {
|
||||
"Content": "Uninstall CTT PowerShell Profile",
|
||||
"category": "Powershell Profile",
|
||||
"panel": "2",
|
||||
"Order": "a084_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300"
|
||||
},
|
||||
"WPFWinUtilSSHServer": {
|
||||
"Content": "Enable OpenSSH Server",
|
||||
"category": "Remote Access",
|
||||
"panel": "2",
|
||||
"Order": "a084_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300"
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
"Standard": [
|
||||
"WPFTweaksAH",
|
||||
"WPFTweaksConsumerFeatures",
|
||||
"WPFTweaksDisableExplorerAutoDiscovery",
|
||||
"WPFTweaksDVR",
|
||||
"WPFTweaksHiber",
|
||||
"WPFTweaksHome",
|
||||
@ -14,11 +15,11 @@
|
||||
"WPFTweaksDeleteTempFiles",
|
||||
"WPFTweaksEndTaskOnTaskbar",
|
||||
"WPFTweaksRestorePoint",
|
||||
"WPFTweaksIPv46",
|
||||
"WPFTweaksPowershell7Tele"
|
||||
],
|
||||
"Minimal": [
|
||||
"WPFTweaksConsumerFeatures",
|
||||
"WPFTweaksDisableExplorerAutoDiscovery",
|
||||
"WPFTweaksHome",
|
||||
"WPFTweaksServices",
|
||||
"WPFTweaksTele"
|
||||
|
@ -1,91 +1,66 @@
|
||||
{
|
||||
"_default": {
|
||||
"shared":{
|
||||
"AppEntryWidth": "130",
|
||||
"AppEntryFontSize": "11",
|
||||
"AppEntryMargin": "1,1,1,1",
|
||||
"AppEntryBorderTickness": "0",
|
||||
"CustomDialogFontSize": "12",
|
||||
"CustomDialogFontSizeHeader": "14",
|
||||
"CustomDialogIconSize": "25",
|
||||
"CustomDialogLogoSize": "25",
|
||||
"CustomDialogWidth": "400",
|
||||
"CustomDialogHeight": "200",
|
||||
|
||||
"FontSize": "12",
|
||||
"FontFamily": "Arial",
|
||||
"FontSizeHeading": "16",
|
||||
"HeaderFontSize": "16",
|
||||
"HeaderFontFamily": "Consolas, Monaco",
|
||||
|
||||
"CheckBoxBulletDecoratorSize": "14",
|
||||
"CheckBoxMargin": "15,0,0,2",
|
||||
|
||||
"TabContentMargin": "5",
|
||||
"TabButtonFontSize": "14",
|
||||
"TabButtonWidth": "100",
|
||||
"TabButtonHeight": "25",
|
||||
"TabButtonWidth": "110",
|
||||
"TabButtonHeight": "26",
|
||||
"TabRowHeightInPixels": "50",
|
||||
"ToolTipWidth": "300",
|
||||
"IconFontSize": "14",
|
||||
"IconButtonSize": "35",
|
||||
"SettingsIconFontSize": "18",
|
||||
"CloseIconFontSize": "18",
|
||||
|
||||
"MicroWinLogoSize": "10",
|
||||
"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",
|
||||
"ComboBoxForegroundColor": "#232629",
|
||||
|
||||
"ButtonFontSize": "12",
|
||||
"ButtonFontFamily": "Arial",
|
||||
"ButtonWidth": "200",
|
||||
"ButtonHeight": "25",
|
||||
"ConfigTabButtonFontSize": "16",
|
||||
|
||||
"ConfigUpdateButtonFontSize": "14",
|
||||
"SearchBarWidth": "200",
|
||||
"SearchBarHeight": "25",
|
||||
"SearchBarHeight": "26",
|
||||
"SearchBarTextBoxFontSize": "12",
|
||||
"SearchBarClearButtonFontSize": "14",
|
||||
|
||||
"ButtonInstallBackgroundColor": "#F7F7F7",
|
||||
"ButtonTweaksBackgroundColor": "#F7F7F7",
|
||||
"ButtonConfigBackgroundColor": "#F7F7F7",
|
||||
"ButtonUpdatesBackgroundColor": "#F7F7F7",
|
||||
"ButtonInstallForegroundColor": "#232629",
|
||||
"ButtonTweaksForegroundColor": "#232629",
|
||||
"ButtonConfigForegroundColor": "#232629",
|
||||
"ButtonUpdatesForegroundColor": "#232629",
|
||||
"ButtonBackgroundColor": "#F5F5F5",
|
||||
"ButtonBackgroundPressedColor": "#1A1A1A",
|
||||
"CheckboxMouseOverColor": "#999999",
|
||||
"ButtonBackgroundMouseoverColor": "#C2C2C2",
|
||||
"ButtonBackgroundSelectedColor": "#F0F0F0",
|
||||
"ButtonForegroundColor": "#232629",
|
||||
"ToggleButtonOnColor": "#2e77ff",
|
||||
|
||||
"ButtonBorderThickness": "1",
|
||||
"ButtonMargin": "1",
|
||||
"ButtonCornerRadius": "2",
|
||||
"BorderColor": "#232629",
|
||||
"BorderOpacity": "0.2",
|
||||
"ShadowPulse": "Forever"
|
||||
"ButtonCornerRadius": "2"
|
||||
},
|
||||
"Classic": {
|
||||
"Light": {
|
||||
"AppInstallUnselectedColor": "#F7F7F7",
|
||||
"AppInstallHighlightedColor": "#CFCFCF",
|
||||
"AppInstallSelectedColor": "#C2C2C2",
|
||||
"ComboBoxForegroundColor": "#232629",
|
||||
"ComboBoxBackgroundColor": "#F7F7F7",
|
||||
"LabelboxForegroundColor": "#232629",
|
||||
"MainForegroundColor": "#232629",
|
||||
"MainBackgroundColor": "#F7F7F7",
|
||||
"LabelBackgroundColor": "#F7F7F7",
|
||||
"LinkForegroundColor": "#232629",
|
||||
"LinkForegroundColor": "#484848",
|
||||
"LinkHoverForegroundColor": "#232629",
|
||||
"GroupBorderBackgroundColor": "#232629",
|
||||
"ComboBoxForegroundColor": "#232629",
|
||||
"ScrollBarBackgroundColor": "#4A4D52",
|
||||
"ScrollBarHoverColor": "#5A5D62",
|
||||
"ScrollBarDraggingColor": "#6A6D72",
|
||||
|
||||
"ProgressBarForegroundColor": "#2e77ff",
|
||||
"ProgressBarBackgroundColor": "Transparent",
|
||||
"ProgressBarTextColor": "#232629",
|
||||
"ButtonInstallBackgroundColor": "#F7F7F7",
|
||||
"ButtonTweaksBackgroundColor": "#F7F7F7",
|
||||
"ButtonConfigBackgroundColor": "#F7F7F7",
|
||||
@ -96,26 +71,35 @@
|
||||
"ButtonUpdatesForegroundColor": "#232629",
|
||||
"ButtonBackgroundColor": "#F5F5F5",
|
||||
"ButtonBackgroundPressedColor": "#1A1A1A",
|
||||
"CheckboxMouseOverColor": "#999999",
|
||||
"ButtonBackgroundMouseoverColor": "#C2C2C2",
|
||||
"ButtonBackgroundSelectedColor": "#F0F0F0",
|
||||
"ButtonForegroundColor": "#232629",
|
||||
"ToggleButtonOnColor": "#2e77ff"
|
||||
"ToggleButtonOnColor": "#2e77ff",
|
||||
"ToggleButtonOffColor": "#707070",
|
||||
"ToolTipBackgroundColor": "#F7F7F7",
|
||||
"BorderColor": "#232629",
|
||||
"BorderOpacity": "0.2"
|
||||
|
||||
},
|
||||
"Matrix": {
|
||||
"ComboBoxBackgroundColor": "#232629",
|
||||
"LabelboxForegroundColor": "#81a1c1",
|
||||
"Dark": {
|
||||
"AppInstallUnselectedColor": "#232629",
|
||||
"AppInstallHighlightedColor": "#3C3C3C",
|
||||
"AppInstallSelectedColor": "#4C4C4C",
|
||||
"ComboBoxForegroundColor": "#F7F7F7",
|
||||
"ComboBoxBackgroundColor": "#1E3747",
|
||||
"LabelboxForegroundColor": "#0567ff",
|
||||
"MainForegroundColor": "#F7F7F7",
|
||||
"MainBackgroundColor": "#232629",
|
||||
"LabelBackgroundColor": "#232629",
|
||||
"LinkForegroundColor": "#add8e6",
|
||||
"LinkHoverForegroundColor": "#F7F7F7",
|
||||
"ComboBoxForegroundColor": "#81a1c1",
|
||||
"ScrollBarBackgroundColor": "#2E3135",
|
||||
"ScrollBarHoverColor": "#3B4252",
|
||||
"ScrollBarDraggingColor": "#5E81AC",
|
||||
|
||||
"ProgressBarForegroundColor": "#222222",
|
||||
"ProgressBarBackgroundColor": "Transparent",
|
||||
"ProgressBarTextColor": "#cccccc",
|
||||
|
||||
"ButtonInstallBackgroundColor": "#222222",
|
||||
"ButtonTweaksBackgroundColor": "#333333",
|
||||
"ButtonConfigBackgroundColor": "#444444",
|
||||
@ -129,41 +113,10 @@
|
||||
"ButtonBackgroundMouseoverColor": "#3B4252",
|
||||
"ButtonBackgroundSelectedColor": "#5E81AC",
|
||||
"ButtonForegroundColor": "#F7F7F7",
|
||||
"ToggleButtonOnColor": "#2e77ff",
|
||||
|
||||
"BorderColor": "#0060CC",
|
||||
"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"
|
||||
"ToggleButtonOnColor": "#2e77ff",
|
||||
"ToggleButtonOffColor": "#707070",
|
||||
"ToolTipBackgroundColor": "#2F373D",
|
||||
"BorderColor": "#2F373D",
|
||||
"BorderOpacity": "0.2"
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@
|
||||
|
||||
#### **Run the latest pre-release**
|
||||
```ps1
|
||||
irm christitus.com/windev | iex
|
||||
irm https://christitus.com/windev | iex
|
||||
```
|
||||
|
||||
!!! bug "Keep in mind"
|
||||
@ -68,9 +68,9 @@ graph TD
|
||||
### 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.
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
### Clone the Fork
|
||||
!!! tip
|
@ -1,18 +1,27 @@
|
||||
### Launch Issues:
|
||||
## Launch Issues
|
||||
|
||||
- Windows Security (formerly Defender) and other anti-virus software are known to block the script. The script gets flagged due to the fact that it requires administrator privileges & makes drastic system changes.
|
||||
- If possible: Allow script in Anti-Virus software settings.
|
||||
### Blocked by anti-virus
|
||||
Windows Security (formerly Defender) and other anti-virus software are known to block the script. The script gets flagged due to the fact that it requires administrator privileges & makes drastic system changes.
|
||||
|
||||
- If you are having TLS 1.2 issues, or are having trouble resolving `christitus.com/win` then run with the following command:
|
||||
To resolve this, allow/whitelist the script in your anti-virus software settings, or temporarily disable real-time protection. Since the project is open source, you may audit the code if security is a concern.
|
||||
|
||||
### Download not working
|
||||
If `https://christitus.com/win` is not working, or you want to download the code from GitHub directly, you can use the direct download link:
|
||||
|
||||
```ps1
|
||||
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12;iex(New-Object Net.WebClient).DownloadString('https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1')
|
||||
irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1 | iex
|
||||
```
|
||||
|
||||
- If you are unable to resolve `christitus.com/win` and are getting errors launching the tool, it might be due to India blocking GitHub's content domain and preventing downloads.
|
||||
- Source: <https://timesofindia.indiatimes.com/gadgets-news/github-content-domain-blocked-for-these-indian-users-reports/articleshow/96687992.cms>
|
||||
If you are seeing errors referencing TLS or security, you may be running an older version of Windows where TLS 1.2 is not the default security protocol used for network connections. The following commands will force .NET to use TLS 1.2, and download the script directly using .NET instead of PowerShell:
|
||||
|
||||
If you are still having issues try using a **VPN**, or changing your **DNS provider** to one of following two providers:
|
||||
```ps1
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
iex (New-Object Net.WebClient).DownloadString('https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1')
|
||||
```
|
||||
|
||||
If it still isn't working and you live in India, it might be due to India blocking GitHub's content domain and preventing downloads. See more on [Times of India](https://timesofindia.indiatimes.com/gadgets-news/github-content-domain-blocked-for-these-indian-users-reports/articleshow/96687992.cms).
|
||||
|
||||
If you are still having issues, try using a **VPN**, or changing your **DNS provider** to one of following two providers:
|
||||
|
||||
| Provider | Primary DNS | Secondary DNS |
|
||||
|:------------:|:------------:|:-------------:|
|
||||
@ -20,160 +29,186 @@ If you are still having issues try using a **VPN**, or changing your **DNS provi
|
||||
| Google | `8.8.8.8` | `8.8.4.4` |
|
||||
|
||||
|
||||
### Script blocked by Execution Policy
|
||||
1. Ensure you are running PowerShell as admin: Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
|
||||
2. In the PowerShell window, type this to allow unsigned code to execute and run the installation script:
|
||||
```ps1
|
||||
Set-ExecutionPolicy Unrestricted -Scope Process -Force
|
||||
irm https://christitus.com/win | iex
|
||||
```
|
||||
|
||||
- Script doesn't run/PowerShell crashes:
|
||||
1. Press Windows Key+X and select 'PowerShell (Admin)' (Windows 10) or 'Windows Terminal (Admin)' (Windows 11)
|
||||
2. Run:
|
||||
```ps1
|
||||
Set-ExecutionPolicy Unrestricted -Scope Process -Force
|
||||
```
|
||||
3. Run:
|
||||
```ps1
|
||||
irm christitus.com/win | iex
|
||||
```
|
||||
## Runtime Issues
|
||||
|
||||
### Other Issues:
|
||||
### WinGet configuration
|
||||
If you have not installed anything using PowerShell before, you may be prompted to configure WinGet. This requires user interaction on first run. You will need to manually type `y` into the PowerShell console and press enter to continue. Once you do it the first time, you will not be prompted again.
|
||||
|
||||
### MicroWin: Error `0x80041031`
|
||||
This error code typically indicates an issue related to Windows Management Instrumentation (WMI). Here are a few steps you can try to resolve the issue:
|
||||
|
||||
1. **Reboot Your Computer:**
|
||||
|
||||
Sometimes, a simple reboot can resolve temporary issues. Restart your computer and try mounting the ISO again.
|
||||
|
||||
3. **Check for System Corruption:**
|
||||
|
||||
Run the System File Checker (SFC) utility to scan and repair system files that may be corrupted.
|
||||
```powershell
|
||||
sfc /scannow
|
||||
```
|
||||
|
||||
4. **Update Your System:**
|
||||
|
||||
Make sure your operating system is up-to-date. Check for Windows updates and install any pending updates.
|
||||
|
||||
5. **Check WMI Service:**
|
||||
|
||||
Ensure that the Windows Management Instrumentation (WMI) service is running. You can do this through the Services application:
|
||||
- Press `Win`+`R` to open the Run dialog.
|
||||
- Type `services.msc` and press Enter.
|
||||
- Locate *Windows Management Instrumentation* in the list.
|
||||
- Make sure to set its status to "Running" and the startup type to "Automatic".
|
||||
|
||||
6. **Check for Security Software Interference:**
|
||||
|
||||
Security software can sometimes interfere with WMI operations. Temporarily disable your anti-virus or security software and check if the issue persists. WMI is a common attack/infection vector, so many anti-virus programs will limit its usage.
|
||||
|
||||
7. **Event Viewer:**
|
||||
|
||||
Check the Event Viewer for more detailed error information. Look for entries related to the `80041031` error and check if there are any additional details that can help identify the cause.
|
||||
|
||||
- Press `Win`+`X` and select *Event Viewer*.
|
||||
- Navigate to *Windows Logs* > *Application* or *System*.
|
||||
- Look for entries with the source related to WMI or the application use to mount the ISO.
|
||||
|
||||
8. **ISO File Integrity:**
|
||||
|
||||
Ensure that the ISO file you are trying to mount is uncorrupted. Try mounting a different ISO file to see if the issue persists.
|
||||
|
||||
If the problem persists after trying these steps, additional troubleshooting is required. Consider seeking assistance from Microsoft support or community forums for more specific guidance based on your system configuration and the software you use to mount the ISO.
|
||||
|
||||
## Windows Issues
|
||||
|
||||
### Windows takes longer to shut down
|
||||
This could be for a number of reasons:
|
||||
- Turn on fast startup: Press `Windows key`+`R`, then type:
|
||||
```bat
|
||||
control /name Microsoft.PowerOptions /page pageGlobalSettings
|
||||
```
|
||||
- If that doesn't work, disable Hibernation:
|
||||
- Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
|
||||
- In the PowerShell window, type:
|
||||
```bat
|
||||
powercfg /H off
|
||||
```
|
||||
Related issue: [#69](https://github.com/ChrisTitusTech/winutil/issues/69)
|
||||
|
||||
### Windows Search does not work
|
||||
Enable Background Apps. Related issues: [#69](https://github.com/ChrisTitusTech/winutil/issues/69) [95](https://github.com/ChrisTitusTech/winutil/issues/95) [#232](https://github.com/ChrisTitusTech/winutil/issues/232)
|
||||
|
||||
### Xbox Game Bar Activation Broken
|
||||
Set the Xbox Accessory Management Service to Automatic:
|
||||
|
||||
- Windows taking longer to shut down:
|
||||
- [#69](https://github.com/ChrisTitusTech/winutil/issues/69) Turn on fast startup: Press Windows key + R, then type:
|
||||
```
|
||||
control /name Microsoft.PowerOptions /page pageGlobalSettings
|
||||
```
|
||||
- If that doesn't work, Disable Hibernation: Press Windows Key+X and select 'PowerShell (Admin)' (Windows 10) or 'Windows Terminal (Admin)' (Windows 11) and enter:
|
||||
```ps1
|
||||
powercfg /H off
|
||||
```
|
||||
- [#69](https://github.com/ChrisTitusTech/winutil/issues/69) [95](https://github.com/ChrisTitusTech/winutil/issues/95) [#232](https://github.com/ChrisTitusTech/winutil/issues/232) Windows Search does not work: Enable Background Apps
|
||||
- [#198](https://github.com/ChrisTitusTech/winutil/issues/198) Xbox Game Bar Activation Broken: Set the Xbox Accessory Management Service to Automatic
|
||||
```ps1
|
||||
Get-Service -Name "XboxGipSvc" | Set-Service -StartupType Automatic
|
||||
```
|
||||
|
||||
- Winget requires interaction on first run: Manually type 'y' and 'enter' into the PowerShell console to continue
|
||||
- (Windows 11) Quick Settings no longer works: Launch the Script and click 'Enable Action Center'
|
||||
Related issue: [#198](https://github.com/ChrisTitusTech/winutil/issues/198)
|
||||
|
||||
- Explorer no longer launches: Go to Control Panel, File Explorer Options, Change the 'Open File Explorer to' option to 'This PC'.
|
||||
### Windows 11: Quick Settings no longer works
|
||||
Launch the Script and click *Enable Action Center*.
|
||||
|
||||
### Battery drains too fast.
|
||||
* When your battery on the laptop drains too fast, please perform these steps and report the results back to the Winutil community.
|
||||
### Explorer (file browser) no longer launches
|
||||
- Press `Windows key`+`R` then type:
|
||||
```bat
|
||||
control /name Microsoft.FolderOptions
|
||||
```
|
||||
- Change the *Open File Explorer to* option to *This PC*.
|
||||
|
||||
### Battery drains too fast
|
||||
If you're using a laptop or tablet and find your battery drains too fast, please try the below troubleshooting steps, and report the results back to the Winutil community.
|
||||
|
||||
1. **Check Battery Health:**
|
||||
- Open a Command Prompt as an administrator.
|
||||
- Run the following command to generate a battery report:
|
||||
```powershell
|
||||
powercfg /batteryreport /output "C:\battery_report.html"
|
||||
```
|
||||
- Open the generated HTML report to review information about battery health and usage.
|
||||
- Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
|
||||
- Run the following command to generate a battery report:
|
||||
```powershell
|
||||
powercfg /batteryreport /output "C:\battery_report.html"
|
||||
```
|
||||
- Open the generated HTML report to review information about battery health and usage. A battery with poor health may hold less charge, discharge faster, or cause other issues.
|
||||
|
||||
2. **Review Power Settings:**
|
||||
- Go to "Settings" > "System" > "Power & sleep."
|
||||
- Adjust power plan settings based on your preferences and usage patterns.
|
||||
- Click on "Additional power settings" to access advanced power settings.
|
||||
- Open the Settings app, and go to *System* > *Power & sleep*.
|
||||
- Adjust power plan settings based on your preferences and usage patterns.
|
||||
- Click on *Additional power settings* to access advanced power settings that may help.
|
||||
|
||||
3. **Identify Power-Hungry Apps:**
|
||||
- Right-click on the taskbar and select "Task Manager."
|
||||
- Navigate to the "Processes" tab to identify applications with high CPU or memory usage.
|
||||
- Consider closing unnecessary background applications.
|
||||
- Right-click on the taskbar and select *Task Manager*.
|
||||
- Navigate to the *Processes* tab to identify applications with high CPU or memory usage.
|
||||
- Consider reconfiguring, closing, disabling, or uninstalling applications that use a lot of resources.
|
||||
|
||||
4. **Update Drivers:**
|
||||
- Visit your laptop manufacturer's website or use Windows Update to check for driver updates.
|
||||
- Ensure graphics, chipset, and other essential drivers are up to date.
|
||||
- Visit your device manufacturer's website or use Windows Update to check for driver updates.
|
||||
- Ensure graphics, chipset, and other essential drivers are up to date.
|
||||
|
||||
5. **Check for Windows Updates:**
|
||||
- Go to "Settings" > "Update & Security" > "Windows Update."
|
||||
- Check for and install any available updates for your operating system.
|
||||
- Open the Settings app, and go to *Update & Security* > *Windows Update*.
|
||||
- Check for and install any available updates for your operating system.
|
||||
|
||||
6. **Reduce Screen Brightness:**
|
||||
- Adjust screen brightness based on your preferences and lighting conditions.
|
||||
- Go to "Settings" > "System" > "Display" to adjust brightness.
|
||||
- Open the Settings app, and go to *System* > *Display*.
|
||||
- Adjust screen brightness based on your preferences and lighting conditions.
|
||||
|
||||
7. **Battery Saver Mode:**
|
||||
- Go to "Settings" > "System" > "Battery."
|
||||
- Turn on "Battery saver" to limit background activity and conserve power.
|
||||
7. **Enable Battery Saver:**
|
||||
- Open the Settings app, and go to *System* > *Battery*.
|
||||
- Turn on *Battery saver* to limit background activity and conserve power.
|
||||
|
||||
8. **Check Power Usage in Settings:**
|
||||
- Go to "Settings" > "System" > "Battery" > "Battery usage by app."
|
||||
- Review the list of apps and their power usage.
|
||||
- Open the Settings app, and go to *System* > *Battery* > *Battery usage by app*.
|
||||
- Review the list of apps and their power usage. Disable or uninstall any you don't need.
|
||||
|
||||
9. **Check Background Apps:**
|
||||
- Go to "Settings" > "Privacy" > "Background apps."
|
||||
- Disable unnecessary apps running in the background.
|
||||
- Open the Settings app, and go to *Privacy* > *Background apps*.
|
||||
- Disable or uninstall unnecessary apps running in the background.
|
||||
|
||||
10. **Use Powercfg for Analysis:**
|
||||
- Open a Command Prompt as an administrator.
|
||||
10. **Use `powercfg` for Analysis:**
|
||||
- Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
|
||||
- Run the following command to analyze energy usage and generate a report:
|
||||
```powershell
|
||||
powercfg /energy /output "C:\energy_report.html"
|
||||
```
|
||||
```powershell
|
||||
powercfg /energy /output "C:\energy_report.html"
|
||||
```
|
||||
- Open the generated HTML report to identify energy consumption patterns.
|
||||
|
||||
11. **Review Event Viewer:**
|
||||
11. **Review Event Logs:**
|
||||
- Open Event Viewer by searching for it in the Start menu.
|
||||
- Navigate to "Windows Logs" > "System."
|
||||
- Look for events with the source "Power-Troubleshooter" to identify power-related events.
|
||||
- Navigate to *Windows Logs* > *System*.
|
||||
- Look for events with the source *Power-Troubleshooter* to identify power-related events. These may highlight battery, input power, and other issues.
|
||||
|
||||
12. **Check Wake-up Sources:**
|
||||
- Open a Command Prompt as an administrator.
|
||||
- Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
|
||||
- Use the command `powercfg /requests` to identify processes preventing sleep.
|
||||
- Check Task Scheduler for tasks waking up the computer.
|
||||
- Use the command `powercfg /waketimers` to view active wake timers.
|
||||
- Check Task Scheduler to see if any of the discovered processes are scheduled to start on boot or at regular intervals.
|
||||
|
||||
13. **Resource Monitor:**
|
||||
13. **Advanced Identification of Power-Hungry Apps:**
|
||||
- Open Resource Monitor from the Start menu.
|
||||
- Navigate to the "CPU" tab and identify processes with high CPU usage.
|
||||
- Navigate to the *CPU*, *Memory*, *Network*, and other tabs to identify processes with high resource usage.
|
||||
- Consider reconfiguring, closing, disabling, or uninstalling applications that use a lot of resources.
|
||||
|
||||
14. **Windows Settings - Activity History:**
|
||||
- In "Settings," go to "Privacy" > "Activity history."
|
||||
- Turn off "Let Windows collect my activities from this PC."
|
||||
14. **Disable Activity History:**
|
||||
- Open the Settings app, and go to *Privacy* > *Activity history*.
|
||||
- Turn off *Let Windows collect my activities from this PC*.
|
||||
|
||||
15. **Network Adapters:**
|
||||
15. **Prevent Network Adapters From Waking PC:**
|
||||
- Open Device Manager by searching for it in the Start menu.
|
||||
- Locate your network adapter, right-click, and go to "Properties."
|
||||
- Under the "Power Management" tab, uncheck the option that allows the device to wake the computer.
|
||||
- Locate your network adapter, right-click, and go to *Properties*.
|
||||
- Under the *Power Management* tab, uncheck the option that allows the device to wake the computer.
|
||||
|
||||
16. **Review Installed Applications:**
|
||||
- Manually review installed applications by searching for "Add or remove programs" in the Start menu.
|
||||
- Manually review installed applications by searching for *Add or remove programs* in the Start menu.
|
||||
- Check settings/preferences of individual applications for power-related options.
|
||||
- Uninstall unnecessary or problematic software.
|
||||
|
||||
* By following these detailed instructions, you should be able to thoroughly diagnose and address battery drain issues on your Windows laptop. Adjust settings as needed to optimize power management and improve battery life.
|
||||
|
||||
### Troubleshoot errors during Microwin usage
|
||||
|
||||
#### Error `0x80041031`
|
||||
|
||||
* This error code typically indicates an issue related to Windows Management Instrumentation (WMI). Here are a few steps you can try to resolve the issue:
|
||||
|
||||
1. **Reboot Your Computer:**
|
||||
Sometimes, a simple reboot can resolve temporary issues. Restart your computer and try mounting the ISO again.
|
||||
|
||||
2. **Check for System Corruption:**
|
||||
Run the System File Checker (SFC) utility to scan and repair system files that may be corrupted.
|
||||
```powershell
|
||||
sfc /scannow
|
||||
```
|
||||
|
||||
3. **Update Your System:**
|
||||
Make sure your operating system is up-to-date. Check for Windows updates and install any pending updates.
|
||||
|
||||
4. **Check WMI Service:**
|
||||
Ensure that the Windows Management Instrumentation (WMI) service is running. You can do this through the Services application:
|
||||
- Press `Win + R` to open the Run dialog.
|
||||
- Type `services.msc` and press Enter.
|
||||
- Locate "Windows Management Instrumentation" in the list.
|
||||
- Make sure to set its status to "Running" and the startup type to "Automatic."
|
||||
|
||||
5. **Check for Security Software Interference:**
|
||||
Security software can sometimes interfere with WMI operations. Temporarily disable your antivirus or security software and check if the issue persists.
|
||||
|
||||
6. **Event Viewer:**
|
||||
Check the Event Viewer for more detailed error information. Look for entries related to the `80041031` error and check if there are any additional details that can help identify the cause.
|
||||
|
||||
- Press `Win + X` and select "Event Viewer."
|
||||
- Navigate to "Windows Logs" -> "Application" or "System."
|
||||
- Look for entries with the source related to WMI or the application use to mount the ISO.
|
||||
|
||||
7. **ISO File Integrity:**
|
||||
Ensure that the ISO file you are trying to mount is uncorrupted. Try mounting a different ISO file to see if the issue persists.
|
||||
|
||||
* If the problem persists after trying these steps, additional troubleshooting is required. Consider seeking assistance from Microsoft support or community forums for more specific guidance based on your system configuration and the software you use to mount the ISO.
|
||||
These troubleshooting steps are generic, but should help in most situations. You should have these key takeaways:
|
||||
- Battery health is the most significant limiter on your device's runtime. A battery in poor health usually cannot be made to last like it used to, simply by closing some applications. Consider replacing your battery.
|
||||
- Background applications that use CPU and memory, make lots of or large network requests, read/write to disk frequently, or that keep your PC awake when it could be conserving energy are the next major concern. Avoid installing programs you don't need, only use programs you trust, and configure applications to use as little power and run as infrequently as possible.
|
||||
- Windows performs a lot of tasks that may affect battery life by default. Changing settings, stopping scheduled tasks, and disabling features can help the system stay in lower power states to conserve battery.
|
||||
- Bad chargers, inconsistent power input, and high temperatures will cause batteries to degrade and discharge faster. Use trusted high-quality chargers, ensure input power is steady, clean any fans or airflow ports, and keep the battery/PC cool.
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 339 KiB After Width: | Height: | Size: 122 KiB |
@ -1,3 +0,0 @@
|
||||
--8<-- ".github/CONTRIBUTING.md"
|
||||
|
||||
<!-- The content is sourced from "CONTRIBUTING.md," located in the root directory of the project. -->
|
91
docs/dev/tweaks/Essential-Tweaks/DisableRecall.md
Normal file
91
docs/dev/tweaks/Essential-Tweaks/DisableRecall.md
Normal 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)
|
@ -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)
|
||||
|
164
docs/devdocs.md
164
docs/devdocs.md
@ -5,104 +5,104 @@
|
||||
|
||||
### Essential-Tweaks
|
||||
|
||||
- [Change Windows Terminal default: PowerShell 5 -> PowerShell 7](../docs/dev/tweaks/Essential-Tweaks/Powershell7.md)
|
||||
- [Create Restore Point](../docs/dev/tweaks/Essential-Tweaks/RestorePoint.md)
|
||||
- [Debloat Edge](../docs/dev/tweaks/Essential-Tweaks/EdgeDebloat.md)
|
||||
- [Delete Temporary Files](../docs/dev/tweaks/Essential-Tweaks/DeleteTempFiles.md)
|
||||
- [Disable Activity History](../docs/dev/tweaks/Essential-Tweaks/AH.md)
|
||||
- [Disable ConsumerFeatures](../docs/dev/tweaks/Essential-Tweaks/ConsumerFeatures.md)
|
||||
- [Disable GameDVR](../docs/dev/tweaks/Essential-Tweaks/DVR.md)
|
||||
- [Disable Hibernation](../docs/dev/tweaks/Essential-Tweaks/Hiber.md)
|
||||
- [Disable Homegroup](../docs/dev/tweaks/Essential-Tweaks/Home.md)
|
||||
- [Disable Location Tracking](../docs/dev/tweaks/Essential-Tweaks/Loc.md)
|
||||
- [Disable Powershell 7 Telemetry](../docs/dev/tweaks/Essential-Tweaks/Powershell7Tele.md)
|
||||
- [Disable Storage Sense](../docs/dev/tweaks/Essential-Tweaks/Storage.md)
|
||||
- [Disable Telemetry](../docs/dev/tweaks/Essential-Tweaks/Tele.md)
|
||||
- [Disable Wifi-Sense](../docs/dev/tweaks/Essential-Tweaks/Wifi.md)
|
||||
- [Enable End Task With Right Click](../docs/dev/tweaks/Essential-Tweaks/EndTaskOnTaskbar.md)
|
||||
- [Prefer IPv4 over IPv6](../docs/dev/tweaks/Essential-Tweaks/IPv46.md)
|
||||
- [Run Disk Cleanup](../docs/dev/tweaks/Essential-Tweaks/DiskCleanup.md)
|
||||
- [Set Hibernation as default (good for laptops)](../docs/dev/tweaks/Essential-Tweaks/LaptopHibernation.md)
|
||||
- [Set Services to Manual](../docs/dev/tweaks/Essential-Tweaks/Services.md)
|
||||
- [Change Windows Terminal default: PowerShell 5 -> PowerShell 7](../dev/tweaks/Essential-Tweaks/Powershell7/)
|
||||
- [Create Restore Point](../dev/tweaks/Essential-Tweaks/RestorePoint/)
|
||||
- [Debloat Edge](../dev/tweaks/Essential-Tweaks/EdgeDebloat/)
|
||||
- [Delete Temporary Files](../dev/tweaks/Essential-Tweaks/DeleteTempFiles/)
|
||||
- [Disable Activity History](../dev/tweaks/Essential-Tweaks/AH/)
|
||||
- [Disable ConsumerFeatures](../dev/tweaks/Essential-Tweaks/ConsumerFeatures/)
|
||||
- [Disable GameDVR](../dev/tweaks/Essential-Tweaks/DVR/)
|
||||
- [Disable Hibernation](../dev/tweaks/Essential-Tweaks/Hiber/)
|
||||
- [Disable Homegroup](../dev/tweaks/Essential-Tweaks/Home/)
|
||||
- [Disable Location Tracking](../dev/tweaks/Essential-Tweaks/Loc/)
|
||||
- [Disable Powershell 7 Telemetry](../dev/tweaks/Essential-Tweaks/Powershell7Tele/)
|
||||
- [Disable Storage Sense](../dev/tweaks/Essential-Tweaks/Storage/)
|
||||
- [Disable Telemetry](../dev/tweaks/Essential-Tweaks/Tele/)
|
||||
- [Disable Wifi-Sense](../dev/tweaks/Essential-Tweaks/Wifi/)
|
||||
- [Enable End Task With Right Click](../dev/tweaks/Essential-Tweaks/EndTaskOnTaskbar/)
|
||||
- [Prefer IPv4 over IPv6](../dev/tweaks/Essential-Tweaks/IPv46/)
|
||||
- [Run Disk Cleanup](../dev/tweaks/Essential-Tweaks/DiskCleanup/)
|
||||
- [Set Hibernation as default (good for laptops)](../dev/tweaks/Essential-Tweaks/LaptopHibernation/)
|
||||
- [Set Services to Manual](../dev/tweaks/Essential-Tweaks/Services/)
|
||||
### Shortcuts
|
||||
|
||||
- [Create WinUtil Shortcut](../docs/dev/tweaks/Shortcuts/Shortcut.md)
|
||||
- [Create WinUtil Shortcut](../dev/tweaks/Shortcuts/Shortcut/)
|
||||
### z--Advanced-Tweaks---CAUTION
|
||||
|
||||
- [Adobe Debloat](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/DebloatAdobe.md)
|
||||
- [Adobe Network Block](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/BlockAdobeNet.md)
|
||||
- [Disable Background Apps](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableBGapps.md)
|
||||
- [Disable Fullscreen Optimizations](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableFSO.md)
|
||||
- [Disable Intel MM (vPro LMS)](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableLMS1.md)
|
||||
- [Disable IPv6](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/Disableipsix.md)
|
||||
- [Disable Microsoft Copilot](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveCopilot.md)
|
||||
- [Disable Notification Tray/Calendar](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableNotifications.md)
|
||||
- [Disable Teredo](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/Teredo.md)
|
||||
- [DNS](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/changedns.md)
|
||||
- [Remove ALL MS Store Apps - NOT RECOMMENDED](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/DeBloat.md)
|
||||
- [Remove Home and Gallery from explorer](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveHomeGallery.md)
|
||||
- [Remove Microsoft Edge](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveEdge.md)
|
||||
- [Remove OneDrive](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveOnedrive.md)
|
||||
- [Run OO Shutup 10](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/OOSUbutton.md)
|
||||
- [Set Classic Right-Click Menu ](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/RightClickMenu.md)
|
||||
- [Set Display for Performance](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/Display.md)
|
||||
- [Set Time to UTC (Dual Boot)](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/UTC.md)
|
||||
- [Adobe Debloat](../dev/tweaks/z--Advanced-Tweaks---CAUTION/DebloatAdobe/)
|
||||
- [Adobe Network Block](../dev/tweaks/z--Advanced-Tweaks---CAUTION/BlockAdobeNet/)
|
||||
- [Disable Background Apps](../dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableBGapps/)
|
||||
- [Disable Fullscreen Optimizations](../dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableFSO/)
|
||||
- [Disable Intel MM (vPro LMS)](../dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableLMS1/)
|
||||
- [Disable IPv6](../dev/tweaks/z--Advanced-Tweaks---CAUTION/Disableipsix/)
|
||||
- [Disable Microsoft Copilot](../dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveCopilot/)
|
||||
- [Disable Notification Tray/Calendar](../dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableNotifications/)
|
||||
- [Disable Teredo](../dev/tweaks/z--Advanced-Tweaks---CAUTION/Teredo/)
|
||||
- [DNS](../dev/tweaks/z--Advanced-Tweaks---CAUTION/changedns/)
|
||||
- [Remove ALL MS Store Apps - NOT RECOMMENDED](../dev/tweaks/z--Advanced-Tweaks---CAUTION/DeBloat/)
|
||||
- [Remove Home and Gallery from explorer](../dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveHomeGallery/)
|
||||
- [Remove Microsoft Edge](../dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveEdge/)
|
||||
- [Remove OneDrive](../dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveOnedrive/)
|
||||
- [Run OO Shutup 10](../dev/tweaks/z--Advanced-Tweaks---CAUTION/OOSUbutton/)
|
||||
- [Set Classic Right-Click Menu ](../dev/tweaks/z--Advanced-Tweaks---CAUTION/RightClickMenu/)
|
||||
- [Set Display for Performance](../dev/tweaks/z--Advanced-Tweaks---CAUTION/Display/)
|
||||
- [Set Time to UTC (Dual Boot)](../dev/tweaks/z--Advanced-Tweaks---CAUTION/UTC/)
|
||||
### Customize-Preferences
|
||||
|
||||
- [Bing Search in Start Menu](../docs/dev/tweaks/Customize-Preferences/BingSearch.md)
|
||||
- [Center Taskbar Items](../docs/dev/tweaks/Customize-Preferences/TaskbarAlignment.md)
|
||||
- [Dark Theme for Windows](../docs/dev/tweaks/Customize-Preferences/DarkMode.md)
|
||||
- [Detailed BSoD](../docs/dev/tweaks/Customize-Preferences/DetailedBSoD.md)
|
||||
- [Mouse Acceleration](../docs/dev/tweaks/Customize-Preferences/MouseAcceleration.md)
|
||||
- [NumLock on Startup](../docs/dev/tweaks/Customize-Preferences/NumLock.md)
|
||||
- [Search Button in Taskbar](../docs/dev/tweaks/Customize-Preferences/TaskbarSearch.md)
|
||||
- [Show File Extensions](../docs/dev/tweaks/Customize-Preferences/ShowExt.md)
|
||||
- [Show Hidden Files](../docs/dev/tweaks/Customize-Preferences/HiddenFiles.md)
|
||||
- [Snap Assist Flyout](../docs/dev/tweaks/Customize-Preferences/SnapFlyout.md)
|
||||
- [Snap Assist Suggestion](../docs/dev/tweaks/Customize-Preferences/SnapSuggestion.md)
|
||||
- [Snap Window](../docs/dev/tweaks/Customize-Preferences/SnapWindow.md)
|
||||
- [Sticky Keys](../docs/dev/tweaks/Customize-Preferences/StickyKeys.md)
|
||||
- [Task View Button in Taskbar](../docs/dev/tweaks/Customize-Preferences/TaskView.md)
|
||||
- [Verbose Messages During Logon](../docs/dev/tweaks/Customize-Preferences/VerboseLogon.md)
|
||||
- [Widgets Button in Taskbar](../docs/dev/tweaks/Customize-Preferences/TaskbarWidgets.md)
|
||||
- [Bing Search in Start Menu](../dev/tweaks/Customize-Preferences/BingSearch/)
|
||||
- [Center Taskbar Items](../dev/tweaks/Customize-Preferences/TaskbarAlignment/)
|
||||
- [Dark Theme for Windows](../dev/tweaks/Customize-Preferences/DarkMode/)
|
||||
- [Detailed BSoD](../dev/tweaks/Customize-Preferences/DetailedBSoD/)
|
||||
- [Mouse Acceleration](../dev/tweaks/Customize-Preferences/MouseAcceleration/)
|
||||
- [NumLock on Startup](../dev/tweaks/Customize-Preferences/NumLock/)
|
||||
- [Search Button in Taskbar](../dev/tweaks/Customize-Preferences/TaskbarSearch/)
|
||||
- [Show File Extensions](../dev/tweaks/Customize-Preferences/ShowExt/)
|
||||
- [Show Hidden Files](../dev/tweaks/Customize-Preferences/HiddenFiles/)
|
||||
- [Snap Assist Flyout](../dev/tweaks/Customize-Preferences/SnapFlyout/)
|
||||
- [Snap Assist Suggestion](../dev/tweaks/Customize-Preferences/SnapSuggestion/)
|
||||
- [Snap Window](../dev/tweaks/Customize-Preferences/SnapWindow/)
|
||||
- [Sticky Keys](../dev/tweaks/Customize-Preferences/StickyKeys/)
|
||||
- [Task View Button in Taskbar](../dev/tweaks/Customize-Preferences/TaskView/)
|
||||
- [Verbose Messages During Logon](../dev/tweaks/Customize-Preferences/VerboseLogon/)
|
||||
- [Widgets Button in Taskbar](../dev/tweaks/Customize-Preferences/TaskbarWidgets/)
|
||||
### Performance-Plans
|
||||
|
||||
- [Add and Activate Ultimate Performance Profile](../docs/dev/tweaks/Performance-Plans/AddUltPerf.md)
|
||||
- [Remove Ultimate Performance Profile](../docs/dev/tweaks/Performance-Plans/RemoveUltPerf.md)
|
||||
- [Add and Activate Ultimate Performance Profile](../dev/tweaks/Performance-Plans/AddUltPerf/)
|
||||
- [Remove Ultimate Performance Profile](../dev/tweaks/Performance-Plans/RemoveUltPerf/)
|
||||
|
||||
## Features
|
||||
|
||||
### Fixes
|
||||
|
||||
- [Remove Adobe Creative Cloud](../docs/dev/features/Fixes/RunAdobeCCCleanerTool.md)
|
||||
- [Reset Network](../docs/dev/features/Fixes/Network.md)
|
||||
- [Reset Windows Update](../docs/dev/features/Fixes/Update.md)
|
||||
- [Set Up Autologin](../docs/dev/features/Fixes/Autologin.md)
|
||||
- [System Corruption Scan](../docs/dev/features/Fixes/DISM.md)
|
||||
- [WinGet Reinstall](../docs/dev/features/Fixes/Winget.md)
|
||||
- [Remove Adobe Creative Cloud](../dev/features/Fixes/RunAdobeCCCleanerTool/)
|
||||
- [Reset Network](../dev/features/Fixes/Network/)
|
||||
- [Reset Windows Update](../dev/features/Fixes/Update/)
|
||||
- [Set Up Autologin](../dev/features/Fixes/Autologin/)
|
||||
- [System Corruption Scan](../dev/features/Fixes/DISM/)
|
||||
- [WinGet Reinstall](../dev/features/Fixes/Winget/)
|
||||
### Legacy-Windows-Panels
|
||||
|
||||
- [Control Panel](../docs/dev/features/Legacy-Windows-Panels/control.md)
|
||||
- [Network Connections](../docs/dev/features/Legacy-Windows-Panels/network.md)
|
||||
- [Power Panel](../docs/dev/features/Legacy-Windows-Panels/power.md)
|
||||
- [Printer Settings](../docs/dev/features/Legacy-Windows-Panels/printer.md)
|
||||
- [Region](../docs/dev/features/Legacy-Windows-Panels/region.md)
|
||||
- [Sound Settings](../docs/dev/features/Legacy-Windows-Panels/sound.md)
|
||||
- [System Properties](../docs/dev/features/Legacy-Windows-Panels/system.md)
|
||||
- [User Accounts](../docs/dev/features/Legacy-Windows-Panels/user.md)
|
||||
- [Control Panel](../dev/features/Legacy-Windows-Panels/control/)
|
||||
- [Network Connections](../dev/features/Legacy-Windows-Panels/network/)
|
||||
- [Power Panel](../dev/features/Legacy-Windows-Panels/power/)
|
||||
- [Printer Settings](../dev/features/Legacy-Windows-Panels/printer/)
|
||||
- [Region](../dev/features/Legacy-Windows-Panels/region/)
|
||||
- [Sound Settings](../dev/features/Legacy-Windows-Panels/sound/)
|
||||
- [System Properties](../dev/features/Legacy-Windows-Panels/system/)
|
||||
- [User Accounts](../dev/features/Legacy-Windows-Panels/user/)
|
||||
### Features
|
||||
|
||||
- [All .Net Framework (2,3,4)](../docs/dev/features/Features/dotnet.md)
|
||||
- [Disable Legacy F8 Boot Recovery](../docs/dev/features/Features/DisableLegacyRecovery.md)
|
||||
- [Disable Search Box Web Suggestions in Registry(explorer restart)](../docs/dev/features/Features/DisableSearchSuggestions.md)
|
||||
- [Enable Daily Registry Backup Task 12.30am](../docs/dev/features/Features/RegBackup.md)
|
||||
- [Enable Legacy F8 Boot Recovery](../docs/dev/features/Features/EnableLegacyRecovery.md)
|
||||
- [Enable Search Box Web Suggestions in Registry(explorer restart)](../docs/dev/features/Features/EnableSearchSuggestions.md)
|
||||
- [HyperV Virtualization](../docs/dev/features/Features/hyperv.md)
|
||||
- [Install Features](../docs/dev/features/Features/Install.md)
|
||||
- [Legacy Media (WMP, DirectPlay)](../docs/dev/features/Features/legacymedia.md)
|
||||
- [NFS - Network File System](../docs/dev/features/Features/nfs.md)
|
||||
- [Windows Sandbox](../docs/dev/features/Features/Sandbox.md)
|
||||
- [Windows Subsystem for Linux](../docs/dev/features/Features/wsl.md)
|
||||
- [All .Net Framework (2,3,4)](../dev/features/Features/dotnet/)
|
||||
- [Disable Legacy F8 Boot Recovery](../dev/features/Features/DisableLegacyRecovery/)
|
||||
- [Disable Search Box Web Suggestions in Registry(explorer restart)](../dev/features/Features/DisableSearchSuggestions/)
|
||||
- [Enable Daily Registry Backup Task 12.30am](../dev/features/Features/RegBackup/)
|
||||
- [Enable Legacy F8 Boot Recovery](../dev/features/Features/EnableLegacyRecovery/)
|
||||
- [Enable Search Box Web Suggestions in Registry(explorer restart)](../dev/features/Features/EnableSearchSuggestions/)
|
||||
- [HyperV Virtualization](../dev/features/Features/hyperv/)
|
||||
- [Install Features](../dev/features/Features/Install/)
|
||||
- [Legacy Media (WMP, DirectPlay)](../dev/features/Features/legacymedia/)
|
||||
- [NFS - Network File System](../dev/features/Features/nfs/)
|
||||
- [Windows Sandbox](../dev/features/Features/Sandbox/)
|
||||
- [Windows Subsystem for Linux](../dev/features/Features/wsl/)
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@ Welcome to the official documentation for WinUtil, your go-to utility for optimi
|
||||
* You will first need to start a Powershell terminal **as Admin**.
|
||||
* Now you can run the following command:
|
||||
```ps1
|
||||
irm christitus.com/win | iex
|
||||
irm https://christitus.com/win | iex
|
||||
```
|
||||
|
||||
!!! info
|
||||
|
@ -34,8 +34,9 @@
|
||||
* By default Winutil will use winget to install/upgrade/remove packages and fallback to Chocolatey. This option reverses the preference.
|
||||
* This preference will be used for all Buttons on the Install page and persist across Winutil restarts
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
!!! tip
|
||||
|
||||
If you have trouble finding an application, press `ctrl + f` and search the name of it. Applications will filter depending on your input.
|
||||
@ -43,8 +44,8 @@
|
||||
## Tweaks
|
||||
---
|
||||
|
||||

|
||||

|
||||

|
||||

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

|
||||

|
||||

|
||||

|
||||
|
||||
#### Basic usage
|
||||
|
||||
@ -234,12 +243,12 @@ With MicroWin, you can also configure your user before proceeding if you don't w
|
||||
* Some features are available through automation. This allows you to save your config file, pass it to WinUtil, walk away and come back to a finished system. Here is how you can set it up currently with Winutil >24.01.15
|
||||
|
||||
* On the Install Tab, click "Get Installed", this will get all installed apps **supported by Winutil** on the system.
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
* Click on the Settings cog in the upper right corner and choose Export. Choose file file and location; this will export the setting file.
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
* Copy this file to a USB or somewhere you can use it after Windows installation.
|
||||
|
||||
@ -249,6 +258,6 @@ With MicroWin, you can also configure your user before proceeding if you don't w
|
||||
|
||||
* On any supported Windows machine, open PowerShell **as Admin** and run the following command to automatically apply tweaks and install apps from the config file.
|
||||
```ps1
|
||||
iex "& { $(irm christitus.com/win) } -Config [path-to-your-config] -Run"
|
||||
iex "& { $(irm https://christitus.com/win) } -Config [path-to-your-config] -Run"
|
||||
```
|
||||
* Have a cup of coffee! Come back when it's done.
|
||||
|
@ -1,4 +1,4 @@
|
||||
function Invoke-WPFMicrowin {
|
||||
function Invoke-Microwin {
|
||||
<#
|
||||
.DESCRIPTION
|
||||
Invoke MicroWin routines...
|
||||
@ -51,14 +51,12 @@ public class PowerManagement {
|
||||
$index = $sync.MicrowinWindowsFlavors.SelectedValue.Split(":")[0].Trim()
|
||||
Write-Host "Index chosen: '$index' from $($sync.MicrowinWindowsFlavors.SelectedValue)"
|
||||
|
||||
$keepPackages = $sync.WPFMicrowinKeepProvisionedPackages.IsChecked
|
||||
$keepProvisionedPackages = $sync.WPFMicrowinKeepAppxPackages.IsChecked
|
||||
$keepDefender = $sync.WPFMicrowinKeepDefender.IsChecked
|
||||
$keepEdge = $sync.WPFMicrowinKeepEdge.IsChecked
|
||||
$copyToUSB = $sync.WPFMicrowinCopyToUsb.IsChecked
|
||||
$injectDrivers = $sync.MicrowinInjectDrivers.IsChecked
|
||||
$importDrivers = $sync.MicrowinImportDrivers.IsChecked
|
||||
|
||||
$importVirtIO = $sync.MicrowinCopyVirtIO.IsChecked
|
||||
|
||||
$mountDir = $sync.MicrowinMountDir.Text
|
||||
$scratchDir = $sync.MicrowinScratchDir.Text
|
||||
|
||||
@ -80,9 +78,10 @@ public class PowerManagement {
|
||||
}
|
||||
|
||||
$imgVersion = (Get-WindowsImage -ImagePath $mountDir\sources\install.wim -Index $index).Version
|
||||
Write-Host "The Windows Image Build Version is: $imgVersion"
|
||||
|
||||
# Detect image version to avoid performing MicroWin processing on Windows 8 and earlier
|
||||
if ((Test-CompatibleImage $imgVersion $([System.Version]::new(10,0,10240,0))) -eq $false) {
|
||||
if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,10240,0))) -eq $false) {
|
||||
$msg = "This image is not compatible with MicroWin processing. Make sure it isn't a Windows 8 or earlier image."
|
||||
$dlg_msg = $msg + "`n`nIf you want more information, the version of the image selected is $($imgVersion)`n`nIf an image has been incorrectly marked as incompatible, report an issue to the developers."
|
||||
Write-Host $msg
|
||||
@ -91,6 +90,14 @@ public class PowerManagement {
|
||||
return
|
||||
}
|
||||
|
||||
# Detect whether the image to process contains Windows 10 and show warning
|
||||
if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,21996,1))) -eq $false) {
|
||||
$msg = "Windows 10 has been detected in the image you want to process. While you can continue, Windows 10 is not a recommended target for MicroWin, and you may not get the full experience."
|
||||
$dlg_msg = $msg
|
||||
Write-Host $msg
|
||||
[System.Windows.MessageBox]::Show($dlg_msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Exclamation)
|
||||
}
|
||||
|
||||
$mountDirExists = Test-Path $mountDir
|
||||
$scratchDirExists = Test-Path $scratchDir
|
||||
if (-not $mountDirExists -or -not $scratchDirExists) {
|
||||
@ -104,7 +111,7 @@ public class PowerManagement {
|
||||
Write-Host "Mounting Windows image. This may take a while."
|
||||
Mount-WindowsImage -ImagePath "$mountDir\sources\install.wim" -Index $index -Path "$scratchDir"
|
||||
if ($?) {
|
||||
Write-Host "Mounting complete! Performing removal of applications..."
|
||||
Write-Host "The Windows image has been mounted successfully. Continuing processing..."
|
||||
} else {
|
||||
Write-Host "Could not mount image. Exiting..."
|
||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||
@ -150,48 +157,74 @@ public class PowerManagement {
|
||||
}
|
||||
}
|
||||
|
||||
if ($importVirtIO) {
|
||||
Write-Host "Copying VirtIO drivers..."
|
||||
Microwin-CopyVirtIO
|
||||
}
|
||||
|
||||
Write-Host "Remove Features from the image"
|
||||
Remove-Features
|
||||
Microwin-RemoveFeatures -UseCmdlets $true
|
||||
Write-Host "Removing features complete!"
|
||||
Write-Host "Removing OS packages"
|
||||
Remove-Packages
|
||||
Microwin-RemovePackages -UseCmdlets $true
|
||||
Write-Host "Removing Appx Bloat"
|
||||
Remove-ProvisionedPackages
|
||||
Microwin-RemoveProvisionedPackages -UseCmdlets $true
|
||||
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\DiagTrack" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\InboxApps" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LocationNotificationWindows.exe"
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Photo Viewer" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Photo Viewer" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Media Player" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Media Player" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Mail" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Mail" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Internet Explorer" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Internet Explorer" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\GameBarPresenceWriter"
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\OneDriveSetup.exe"
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\OneDrive.ico"
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*narratorquickstart*" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*ParentalControls*" -Directory
|
||||
# Detect Windows 11 24H2 and add dependency to FileExp to prevent Explorer look from going back - thanks @WitherOrNot and @thecatontheceiling
|
||||
if ((Microwin-TestCompatibleImage $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 "$(Microwin-GetLocalizedUsers -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 {
|
||||
# Fall back to what we used to do: delayed disablement
|
||||
Enable-WindowsOptionalFeature -Path "$scratchDir" -FeatureName "Recall"
|
||||
}
|
||||
}
|
||||
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\DiagTrack" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\InboxApps" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LocationNotificationWindows.exe"
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Media Player" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Media Player" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Mail" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Mail" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Internet Explorer" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Internet Explorer" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\GameBarPresenceWriter"
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\OneDriveSetup.exe"
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\OneDrive.ico"
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*narratorquickstart*" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*ParentalControls*" -Directory
|
||||
Write-Host "Removal complete!"
|
||||
|
||||
Write-Host "Create unattend.xml"
|
||||
#New-Unattend
|
||||
|
||||
if ($sync.MicrowinUserName.Text -eq "")
|
||||
{
|
||||
New-Unattend -userName "User"
|
||||
Microwin-NewUnattend -userName "User"
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($sync.MicrowinUserPassword.Password -eq "")
|
||||
{
|
||||
New-Unattend -userName "$($sync.MicrowinUserName.Text)"
|
||||
Microwin-NewUnattend -userName "$($sync.MicrowinUserName.Text)"
|
||||
}
|
||||
else
|
||||
{
|
||||
New-Unattend -userName "$($sync.MicrowinUserName.Text)" -userPassword "$($sync.MicrowinUserPassword.Password)"
|
||||
Microwin-NewUnattend -userName "$($sync.MicrowinUserName.Text)" -userPassword "$($sync.MicrowinUserPassword.Password)"
|
||||
}
|
||||
}
|
||||
Write-Host "Done Create unattend.xml"
|
||||
@ -204,7 +237,7 @@ public class PowerManagement {
|
||||
Write-Host "Done Copy unattend.xml"
|
||||
|
||||
Write-Host "Create FirstRun"
|
||||
New-FirstRun
|
||||
Microwin-NewFirstRun
|
||||
Write-Host "Done create FirstRun"
|
||||
Write-Host "Copy FirstRun.ps1 into the ISO"
|
||||
Copy-Item "$env:temp\FirstStartup.ps1" "$($scratchDir)\Windows\FirstStartup.ps1" -force
|
||||
@ -216,7 +249,7 @@ public class PowerManagement {
|
||||
dism /English /image:$($scratchDir) /set-profilepath:"$($scratchDir)\Windows\Users\Default"
|
||||
|
||||
Write-Host "Copy checkinstall.cmd into the ISO"
|
||||
New-CheckInstall
|
||||
Microwin-NewCheckInstall
|
||||
Copy-Item "$env:temp\checkinstall.cmd" "$($scratchDir)\Windows\checkinstall.cmd" -force
|
||||
Write-Host "Done copy checkinstall.cmd"
|
||||
|
||||
@ -238,6 +271,9 @@ public class PowerManagement {
|
||||
# Write-Host Error code $LASTEXITCODE
|
||||
Write-Host "Done disabling Teams"
|
||||
|
||||
Write-Host "Fix Windows Volume Mixer Issue"
|
||||
reg add "HKLM\zNTUSER\Software\Microsoft\Internet Explorer\LowRegistry\Audio\PolicyConfig\PropertyStore" /f
|
||||
|
||||
Write-Host "Bypassing system requirements (system image)"
|
||||
reg add "HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV1" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d 0 /f
|
||||
@ -250,20 +286,22 @@ public class PowerManagement {
|
||||
reg add "HKLM\zSYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d 1 /f
|
||||
reg add "HKLM\zSYSTEM\Setup\MoSetup" /v "AllowUpgradesWithUnsupportedTPMOrCPU" /t REG_DWORD /d 1 /f
|
||||
|
||||
# Prevent Windows Update Installing so called Expedited Apps
|
||||
@(
|
||||
'EdgeUpdate',
|
||||
'DevHomeUpdate',
|
||||
'OutlookUpdate',
|
||||
'CrossDeviceUpdate'
|
||||
) | ForEach-Object {
|
||||
Write-Host "Removing Windows Expedited App: $_"
|
||||
# Prevent Windows Update Installing so called Expedited Apps - 24H2 and newer
|
||||
if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,26100,1))) -eq $true) {
|
||||
@(
|
||||
'EdgeUpdate',
|
||||
'DevHomeUpdate',
|
||||
'OutlookUpdate',
|
||||
'CrossDeviceUpdate'
|
||||
) | ForEach-Object {
|
||||
Write-Host "Removing Windows Expedited App: $_"
|
||||
|
||||
# Copied here After Installation (Online)
|
||||
# reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\$_" /f | Out-Null
|
||||
# Copied here After Installation (Online)
|
||||
# reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\$_" /f | Out-Null
|
||||
|
||||
# When in Offline Image
|
||||
reg delete "HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\$_" /f | Out-Null
|
||||
# When in Offline Image
|
||||
reg delete "HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\$_" /f | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
|
||||
@ -289,6 +327,20 @@ public class PowerManagement {
|
||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "AppsUseLightTheme" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "SystemUsesLightTheme" /t REG_DWORD /d 0 /f
|
||||
|
||||
if ((Microwin-TestCompatibleImage $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
|
||||
reg add "HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Feeds" /v "EnableFeeds" /t REG_DWORD /d 0 /f
|
||||
}
|
||||
|
||||
} catch {
|
||||
Write-Error "An unexpected error occurred: $_"
|
||||
} finally {
|
||||
@ -388,7 +440,7 @@ public class PowerManagement {
|
||||
|
||||
if ($copyToUSB) {
|
||||
Write-Host "Copying target ISO to the USB drive"
|
||||
Copy-ToUSB("$($SaveDialog.FileName)")
|
||||
Microwin-CopyToUSB("$($SaveDialog.FileName)")
|
||||
if ($?) { Write-Host "Done Copying target ISO to USB drive!" } else { Write-Host "ISO copy failed." }
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
function Invoke-WPFGetIso {
|
||||
function Invoke-MicrowinGetIso {
|
||||
<#
|
||||
.DESCRIPTION
|
||||
Function to get the path to Iso file for MicroWin, unpack that isom=, read basic information and populate the UI Options
|
||||
@ -50,7 +50,7 @@ function Invoke-WPFGetIso {
|
||||
return
|
||||
} else {
|
||||
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it from github. This might take a long time.")
|
||||
Get-Oscdimg -oscdimgPath $oscdimgPath
|
||||
Microwin-GetOscdimg -oscdimgPath $oscdimgPath
|
||||
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
|
||||
if (!$oscdImgFound) {
|
||||
$msg = "oscdimg was not downloaded can not proceed"
|
||||
@ -62,17 +62,79 @@ function Invoke-WPFGetIso {
|
||||
}
|
||||
}
|
||||
|
||||
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
|
||||
$openFileDialog = New-Object System.Windows.Forms.OpenFileDialog
|
||||
$openFileDialog.initialDirectory = $initialDirectory
|
||||
$openFileDialog.filter = "ISO files (*.iso)| *.iso"
|
||||
$openFileDialog.ShowDialog() | Out-Null
|
||||
$filePath = $openFileDialog.FileName
|
||||
if ($sync["ISOmanual"].IsChecked) {
|
||||
# Open file dialog to let user choose the ISO file
|
||||
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
|
||||
$openFileDialog = New-Object System.Windows.Forms.OpenFileDialog
|
||||
$openFileDialog.initialDirectory = $initialDirectory
|
||||
$openFileDialog.filter = "ISO files (*.iso)| *.iso"
|
||||
$openFileDialog.ShowDialog() | Out-Null
|
||||
$filePath = $openFileDialog.FileName
|
||||
|
||||
if ([string]::IsNullOrEmpty($filePath)) {
|
||||
Write-Host "No ISO is chosen"
|
||||
$sync.BusyMessage.Visibility="Hidden"
|
||||
return
|
||||
if ([string]::IsNullOrEmpty($filePath)) {
|
||||
Write-Host "No ISO is chosen"
|
||||
$sync.BusyMessage.Visibility="Hidden"
|
||||
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) {
|
||||
Microwin-GetLangFromCulture -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)"
|
||||
@ -107,7 +169,7 @@ function Invoke-WPFGetIso {
|
||||
try {
|
||||
Write-Host "Mounting Iso. Please wait."
|
||||
$mountedISO = Mount-DiskImage -PassThru "$filePath"
|
||||
Write-Host "Done mounting Iso $mountedISO"
|
||||
Write-Host "Done mounting Iso `"$($mountedISO.ImagePath)`""
|
||||
$driveLetter = (Get-Volume -DiskImage $mountedISO).DriveLetter
|
||||
Write-Host "Iso mounted to '$driveLetter'"
|
||||
} catch {
|
||||
@ -127,7 +189,7 @@ function Invoke-WPFGetIso {
|
||||
$sync.MicrowinScratchDirBox.Text =""
|
||||
}
|
||||
|
||||
$UseISOScratchDir = $sync.WPFMicrowinISOScratchDir.IsChecked
|
||||
$UseISOScratchDir = $sync.WPFMicrowinISOScratchDir.IsChecked
|
||||
|
||||
if ($UseISOScratchDir) {
|
||||
$sync.MicrowinScratchDirBox.Text=$mountedISOPath
|
||||
@ -158,10 +220,10 @@ function Invoke-WPFGetIso {
|
||||
$sync.BusyText.Text=" - Mounting"
|
||||
Write-Host "Mounting Iso. Please wait."
|
||||
if ($sync.MicrowinScratchDirBox.Text -eq "") {
|
||||
$mountDir = Join-Path $env:TEMP $randomMicrowin
|
||||
$scratchDir = Join-Path $env:TEMP $randomMicrowinScratch
|
||||
$mountDir = Join-Path $env:TEMP $randomMicrowin
|
||||
$scratchDir = Join-Path $env:TEMP $randomMicrowinScratch
|
||||
} else {
|
||||
$scratchDir = $sync.MicrowinScratchDirBox.Text+"Scrach"
|
||||
$scratchDir = $sync.MicrowinScratchDirBox.Text+"Scratch"
|
||||
$mountDir = $sync.MicrowinScratchDirBox.Text+"micro"
|
||||
}
|
||||
|
||||
@ -180,8 +242,8 @@ function Invoke-WPFGetIso {
|
||||
|
||||
# xcopy we can verify files and also not copy files that already exist, but hard to measure
|
||||
# xcopy.exe /E /I /H /R /Y /J $DriveLetter":" $mountDir >$null
|
||||
$totalTime = Measure-Command { Copy-Files "$($driveLetter):" $mountDir -Recurse -Force }
|
||||
Write-Host "Copy complete! Total Time: $($totalTime.Minutes)m$($totalTime.Seconds)s"
|
||||
$totalTime = Measure-Command { Copy-Files "$($driveLetter):" "$mountDir" -Recurse -Force }
|
||||
Write-Host "Copy complete! Total Time: $($totalTime.Minutes) minutes, $($totalTime.Seconds) seconds"
|
||||
|
||||
$wimFile = "$mountDir\sources\install.wim"
|
||||
Write-Host "Getting image information $wimFile"
|
10
functions/microwin/Microwin-Classes.ps1
Normal file
10
functions/microwin/Microwin-Classes.ps1
Normal file
@ -0,0 +1,10 @@
|
||||
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
|
||||
}
|
||||
}
|
71
functions/microwin/Microwin-CopyToUSB.ps1
Normal file
71
functions/microwin/Microwin-CopyToUSB.ps1
Normal file
@ -0,0 +1,71 @@
|
||||
function Microwin-CopyToUSB([string]$fileToCopy) {
|
||||
foreach ($volume in Get-Volume) {
|
||||
if ($volume -and $volume.FileSystemLabel -ieq "ventoy") {
|
||||
$destinationPath = "$($volume.DriveLetter):\"
|
||||
#Copy-Item -Path $fileToCopy -Destination $destinationPath -Force
|
||||
# Get the total size of the file
|
||||
$totalSize = (Get-Item "$fileToCopy").length
|
||||
|
||||
Copy-Item -Path "$fileToCopy" -Destination "$destinationPath" -Verbose -Force -Recurse -Container -PassThru |
|
||||
ForEach-Object {
|
||||
# Calculate the percentage completed
|
||||
$completed = ($_.BytesTransferred / $totalSize) * 100
|
||||
|
||||
# Display the progress bar
|
||||
Write-Progress -Activity "Copying File" -Status "Progress" -PercentComplete $completed -CurrentOperation ("{0:N2} MB / {1:N2} MB" -f ($_.BytesTransferred / 1MB), ($totalSize / 1MB))
|
||||
}
|
||||
|
||||
Write-Host "File copied to Ventoy drive $($volume.DriveLetter)"
|
||||
|
||||
# Detect if config files are present, move them if they are, and configure the Ventoy drive to not bypass the requirements
|
||||
$customVentoyConfig = @'
|
||||
{
|
||||
"control":[
|
||||
{ "VTOY_WIN11_BYPASS_CHECK": "0" },
|
||||
{ "VTOY_WIN11_BYPASS_NRO": "0" }
|
||||
],
|
||||
"control_legacy":[
|
||||
{ "VTOY_WIN11_BYPASS_CHECK": "0" },
|
||||
{ "VTOY_WIN11_BYPASS_NRO": "0" }
|
||||
],
|
||||
"control_uefi":[
|
||||
{ "VTOY_WIN11_BYPASS_CHECK": "0" },
|
||||
{ "VTOY_WIN11_BYPASS_NRO": "0" }
|
||||
],
|
||||
"control_ia32":[
|
||||
{ "VTOY_WIN11_BYPASS_CHECK": "0" },
|
||||
{ "VTOY_WIN11_BYPASS_NRO": "0" }
|
||||
],
|
||||
"control_aa64":[
|
||||
{ "VTOY_WIN11_BYPASS_CHECK": "0" },
|
||||
{ "VTOY_WIN11_BYPASS_NRO": "0" }
|
||||
],
|
||||
"control_mips":[
|
||||
{ "VTOY_WIN11_BYPASS_CHECK": "0" },
|
||||
{ "VTOY_WIN11_BYPASS_NRO": "0" }
|
||||
]
|
||||
}
|
||||
'@
|
||||
|
||||
try {
|
||||
Write-Host "Writing custom Ventoy configuration. Please wait..."
|
||||
if (Test-Path -Path "$($volume.DriveLetter):\ventoy\ventoy.json" -PathType Leaf) {
|
||||
Write-Host "A Ventoy configuration file exists. Moving it..."
|
||||
Move-Item -Path "$($volume.DriveLetter):\ventoy\ventoy.json" -Destination "$($volume.DriveLetter):\ventoy\ventoy.json.old" -Force
|
||||
Write-Host "Existing Ventoy configuration has been moved to `"ventoy.json.old`". Feel free to put your config back into the `"ventoy.json`" file."
|
||||
}
|
||||
if (-not (Test-Path -Path "$($volume.DriveLetter):\ventoy")) {
|
||||
New-Item -Path "$($volume.DriveLetter):\ventoy" -ItemType Directory -Force | Out-Null
|
||||
}
|
||||
$customVentoyConfig | Out-File -FilePath "$($volume.DriveLetter):\ventoy\ventoy.json" -Encoding utf8 -Force
|
||||
Write-Host "The Ventoy drive has been successfully configured."
|
||||
} catch {
|
||||
Write-Host "Could not configure Ventoy drive. Error: $($_.Exception.Message)`n"
|
||||
Write-Host "Be sure to add the following configuration to the Ventoy drive by either creating a `"ventoy.json`" file in the `"ventoy`" directory (create it if it doesn't exist) or by editing an existing one: `n`n$customVentoyConfig`n"
|
||||
Write-Host "Failure to do this will cause conflicts with your target ISO file."
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
Write-Host "Ventoy USB Key is not inserted"
|
||||
}
|
40
functions/microwin/Microwin-CopyVirtIO.ps1
Normal file
40
functions/microwin/Microwin-CopyVirtIO.ps1
Normal file
@ -0,0 +1,40 @@
|
||||
function Microwin-CopyVirtIO {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Downloads and copies the VirtIO Guest Tools drivers to the target MicroWin ISO
|
||||
.NOTES
|
||||
A network connection must be available and the servers of Fedora People must be up. Automatic driver installation will not be added yet - I want this implementation to be reliable.
|
||||
#>
|
||||
|
||||
try {
|
||||
Write-Host "Checking existing files..."
|
||||
if (Test-Path -Path "$($env:TEMP)\virtio.iso" -PathType Leaf) {
|
||||
Write-Host "VirtIO ISO has been detected. Deleting..."
|
||||
Remove-Item -Path "$($env:TEMP)\virtio.iso" -Force
|
||||
}
|
||||
Write-Host "Getting latest VirtIO drivers. Please wait. This can take some time, depending on your network connection speed and the speed of the servers..."
|
||||
Start-BitsTransfer -Source "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso" -Destination "$($env:TEMP)\virtio.iso" -DisplayName "Downloading VirtIO drivers..."
|
||||
# Do everything else if the VirtIO ISO exists
|
||||
if (Test-Path -Path "$($env:TEMP)\virtio.iso" -PathType Leaf) {
|
||||
Write-Host "Mounting ISO. Please wait."
|
||||
$virtIO_ISO = Mount-DiskImage -PassThru "$($env:TEMP)\virtio.iso"
|
||||
$driveLetter = (Get-Volume -DiskImage $virtIO_ISO).DriveLetter
|
||||
# Create new directory for VirtIO on ISO
|
||||
New-Item -Path "$mountDir\VirtIO" -ItemType Directory | Out-Null
|
||||
$totalTime = Measure-Command { Copy-Files "$($driveLetter):" "$mountDir\VirtIO" -Recurse -Force }
|
||||
Write-Host "VirtIO contents have been successfully copied. Time taken: $($totalTime.Minutes) minutes, $($totalTime.Seconds) seconds`n"
|
||||
Get-Volume $driveLetter | Get-DiskImage | Dismount-DiskImage
|
||||
Remove-Item -Path "$($env:TEMP)\virtio.iso" -Force -ErrorAction SilentlyContinue
|
||||
Write-Host "To proceed with installation of the MicroWin image in QEMU/Proxmox VE:"
|
||||
Write-Host "1. Proceed with Setup until you reach the disk selection screen, in which you won't see any drives"
|
||||
Write-Host "2. Click `"Load Driver`" and click Browse"
|
||||
Write-Host "3. In the folder selection dialog, point to this path:`n`n `"D:\VirtIO\vioscsi\w11\amd64`" (replace amd64 with ARM64 if you are using Windows on ARM, and `"D:`" with the drive letter of the ISO)`n"
|
||||
Write-Host "4. Select all drivers that will appear in the list box and click OK"
|
||||
} else {
|
||||
throw "Could not download VirtIO drivers"
|
||||
}
|
||||
} catch {
|
||||
Write-Host "We could not download and/or prepare the VirtIO drivers. Error information: $_`n"
|
||||
Write-Host "You will need to download these drivers manually. Location: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso"
|
||||
}
|
||||
}
|
49
functions/microwin/Microwin-GetLangFromCulture.ps1
Normal file
49
functions/microwin/Microwin-GetLangFromCulture.ps1
Normal file
@ -0,0 +1,49 @@
|
||||
function Microwin-GetLangFromCulture {
|
||||
|
||||
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" }
|
||||
}
|
||||
}
|
21
functions/microwin/Microwin-GetLocalizedUsers.ps1
Normal file
21
functions/microwin/Microwin-GetLocalizedUsers.ps1
Normal file
@ -0,0 +1,21 @@
|
||||
function Microwin-GetLocalizedUsers
|
||||
{
|
||||
<#
|
||||
.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
|
||||
Microwin-GetLocalizedUsers -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
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
function Get-Oscdimg {
|
||||
function Microwin-GetOscdimg {
|
||||
<#
|
||||
.DESCRIPTION
|
||||
This function will download oscdimg file from github Release folders and put it into env:temp folder
|
||||
|
||||
.EXAMPLE
|
||||
Get-Oscdimg
|
||||
Microwin-GetOscdimg
|
||||
#>
|
||||
|
||||
param(
|
73
functions/microwin/Microwin-NewCheckInstall.ps1
Normal file
73
functions/microwin/Microwin-NewCheckInstall.ps1
Normal file
@ -0,0 +1,73 @@
|
||||
function Microwin-NewCheckInstall {
|
||||
|
||||
# using here string to embedd firstrun
|
||||
$checkInstall = @'
|
||||
@echo off
|
||||
if exist "%HOMEDRIVE%\windows\cpu.txt" (
|
||||
echo %HOMEDRIVE%\windows\cpu.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\windows\cpu.txt does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\windows\SerialNumber.txt" (
|
||||
echo %HOMEDRIVE%\windows\SerialNumber.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\windows\SerialNumber.txt does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\unattend.xml" (
|
||||
echo %HOMEDRIVE%\unattend.xml exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\unattend.xml does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\Setup\Scripts\SetupComplete.cmd" (
|
||||
echo %HOMEDRIVE%\Windows\Setup\Scripts\SetupComplete.cmd exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\Setup\Scripts\SetupComplete.cmd does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\Panther\unattend.xml" (
|
||||
echo %HOMEDRIVE%\Windows\Panther\unattend.xml exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\Panther\unattend.xml does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\System32\Sysprep\unattend.xml" (
|
||||
echo %HOMEDRIVE%\Windows\System32\Sysprep\unattend.xml exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\System32\Sysprep\unattend.xml does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\FirstStartup.ps1" (
|
||||
echo %HOMEDRIVE%\Windows\FirstStartup.ps1 exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\FirstStartup.ps1 does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\winutil.ps1" (
|
||||
echo %HOMEDRIVE%\Windows\winutil.ps1 exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\winutil.ps1 does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\LogSpecialize.txt" (
|
||||
echo %HOMEDRIVE%\Windows\LogSpecialize.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\LogSpecialize.txt does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\LogAuditUser.txt" (
|
||||
echo %HOMEDRIVE%\Windows\LogAuditUser.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\LogAuditUser.txt does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\LogOobeSystem.txt" (
|
||||
echo %HOMEDRIVE%\Windows\LogOobeSystem.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\LogOobeSystem.txt does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\windows\csup.txt" (
|
||||
echo %HOMEDRIVE%\windows\csup.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\windows\csup.txt does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\windows\LogFirstRun.txt" (
|
||||
echo %HOMEDRIVE%\windows\LogFirstRun.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\windows\LogFirstRun.txt does not exist
|
||||
)
|
||||
'@
|
||||
$checkInstall | Out-File -FilePath "$env:temp\checkinstall.cmd" -Force -Encoding Ascii
|
||||
}
|
91
functions/microwin/Microwin-NewFirstRun.ps1
Normal file
91
functions/microwin/Microwin-NewFirstRun.ps1
Normal file
@ -0,0 +1,91 @@
|
||||
function Microwin-NewFirstRun {
|
||||
|
||||
# using here string to embedd firstrun
|
||||
$firstRun = @'
|
||||
# Set the global error action preference to continue
|
||||
$ErrorActionPreference = "Continue"
|
||||
function Remove-RegistryValue {
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$RegistryPath,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$ValueName
|
||||
)
|
||||
|
||||
# Check if the registry path exists
|
||||
if (Test-Path -Path $RegistryPath) {
|
||||
$registryValue = Get-ItemProperty -Path $RegistryPath -Name $ValueName -ErrorAction SilentlyContinue
|
||||
|
||||
# Check if the registry value exists
|
||||
if ($registryValue) {
|
||||
# Remove the registry value
|
||||
Remove-ItemProperty -Path $RegistryPath -Name $ValueName -Force
|
||||
Write-Host "Registry value '$ValueName' removed from '$RegistryPath'."
|
||||
} else {
|
||||
Write-Host "Registry value '$ValueName' not found in '$RegistryPath'."
|
||||
}
|
||||
} else {
|
||||
Write-Host "Registry path '$RegistryPath' not found."
|
||||
}
|
||||
}
|
||||
|
||||
"FirstStartup has worked" | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber
|
||||
|
||||
$taskbarPath = "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
|
||||
# Delete all files on the Taskbar
|
||||
Get-ChildItem -Path $taskbarPath -File | Remove-Item -Force
|
||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesRemovedChanges"
|
||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesChanges"
|
||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "Favorites"
|
||||
|
||||
# Delete Edge Icon from the desktop
|
||||
$edgeShortcutFiles = Get-ChildItem -Path $desktopPath -Filter "*Edge*.lnk"
|
||||
# Check if Edge shortcuts exist on the desktop
|
||||
if ($edgeShortcutFiles) {
|
||||
foreach ($shortcutFile in $edgeShortcutFiles) {
|
||||
# Remove each Edge shortcut
|
||||
Remove-Item -Path $shortcutFile.FullName -Force
|
||||
Write-Host "Edge shortcut '$($shortcutFile.Name)' removed from the desktop."
|
||||
}
|
||||
}
|
||||
Remove-Item -Path "$env:USERPROFILE\Desktop\*.lnk"
|
||||
Remove-Item -Path "$env:HOMEDRIVE\Users\Default\Desktop\*.lnk"
|
||||
|
||||
try
|
||||
{
|
||||
if ((Get-WindowsOptionalFeature -Online | Where-Object { $_.State -eq 'Enabled' -and $_.FeatureName -like "Recall" }).Count -gt 0)
|
||||
{
|
||||
Disable-WindowsOptionalFeature -Online -FeatureName "Recall" -Remove
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
# Get BCD entries and set bootmgr timeout accordingly
|
||||
try
|
||||
{
|
||||
# Check if the number of occurrences of "path" is 2 - this fixes the Boot Manager screen issue (#2562)
|
||||
if ((bcdedit | Select-String "path").Count -eq 2)
|
||||
{
|
||||
# Set bootmgr timeout to 0
|
||||
bcdedit /set `{bootmgr`} timeout 0
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.Suggested" /f
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.Suggested" /v Enabled /t REG_DWORD /d 0 /f
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.StartupApp" /f
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.StartupApp" /v Enabled /t REG_DWORD /d 0 /f
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.SkyDrive.Desktop" /f
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.SkyDrive.Desktop" /v Enabled /t REG_DWORD /d 0 /f
|
||||
|
||||
'@
|
||||
$firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force
|
||||
}
|
@ -1,262 +1,4 @@
|
||||
function Test-CompatibleImage() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the version of a Windows image and determines whether or not it is compatible with a specific feature depending on a desired version
|
||||
|
||||
.PARAMETER Name
|
||||
imgVersion - The version of the Windows image
|
||||
desiredVersion - The version to compare the image version with
|
||||
#>
|
||||
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory, position=0)]
|
||||
[string]$imgVersion,
|
||||
|
||||
[Parameter(Mandatory, position=1)]
|
||||
[Version]$desiredVersion
|
||||
)
|
||||
|
||||
try {
|
||||
$version = [Version]$imgVersion
|
||||
return $version -ge $desiredVersion
|
||||
} catch {
|
||||
return $False
|
||||
}
|
||||
}
|
||||
|
||||
function Remove-Features() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes certain features from ISO image
|
||||
|
||||
.PARAMETER Name
|
||||
No Params
|
||||
|
||||
.EXAMPLE
|
||||
Remove-Features
|
||||
#>
|
||||
try {
|
||||
$featlist = (Get-WindowsOptionalFeature -Path $scratchDir)
|
||||
|
||||
$featlist = $featlist | Where-Object {
|
||||
$_.FeatureName -NotLike "*Defender*" -AND
|
||||
$_.FeatureName -NotLike "*Printing*" -AND
|
||||
$_.FeatureName -NotLike "*TelnetClient*" -AND
|
||||
$_.FeatureName -NotLike "*PowerShell*" -AND
|
||||
$_.FeatureName -NotLike "*NetFx*" -AND
|
||||
$_.FeatureName -NotLike "*Media*" -AND
|
||||
$_.FeatureName -NotLike "*NFS*" -AND
|
||||
$_.State -ne "Disabled"
|
||||
}
|
||||
|
||||
foreach($feature in $featlist) {
|
||||
$status = "Removing feature $($feature.FeatureName)"
|
||||
Write-Progress -Activity "Removing features" -Status $status -PercentComplete ($counter++/$featlist.Count*100)
|
||||
Write-Debug "Removing feature $($feature.FeatureName)"
|
||||
Disable-WindowsOptionalFeature -Path "$scratchDir" -FeatureName $($feature.FeatureName) -Remove -ErrorAction SilentlyContinue -NoRestart
|
||||
}
|
||||
Write-Progress -Activity "Removing features" -Status "Ready" -Completed
|
||||
Write-Host "You can re-enable the disabled features at any time, using either Windows Update or the SxS folder in <installation media>\Sources."
|
||||
} catch {
|
||||
Write-Host "Unable to get information about the features. MicroWin processing will continue, but features will not be processed"
|
||||
Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
function Remove-Packages {
|
||||
try {
|
||||
$pkglist = (Get-WindowsPackage -Path "$scratchDir").PackageName
|
||||
|
||||
$pkglist = $pkglist | Where-Object {
|
||||
$_ -NotLike "*ApplicationModel*" -AND
|
||||
$_ -NotLike "*indows-Client-LanguagePack*" -AND
|
||||
$_ -NotLike "*LanguageFeatures-Basic*" -AND
|
||||
$_ -NotLike "*Package_for_ServicingStack*" -AND
|
||||
$_ -NotLike "*.NET*" -AND
|
||||
$_ -NotLike "*Store*" -AND
|
||||
$_ -NotLike "*VCLibs*" -AND
|
||||
$_ -NotLike "*AAD.BrokerPlugin",
|
||||
$_ -NotLike "*LockApp*" -AND
|
||||
$_ -NotLike "*Notepad*" -AND
|
||||
$_ -NotLike "*immersivecontrolpanel*" -AND
|
||||
$_ -NotLike "*ContentDeliveryManager*" -AND
|
||||
$_ -NotLike "*PinningConfirMationDialog*" -AND
|
||||
$_ -NotLike "*SecHealthUI*" -AND
|
||||
$_ -NotLike "*SecureAssessmentBrowser*" -AND
|
||||
$_ -NotLike "*PrintDialog*" -AND
|
||||
$_ -NotLike "*AssignedAccessLockApp*" -AND
|
||||
$_ -NotLike "*OOBENetworkConnectionFlow*" -AND
|
||||
$_ -NotLike "*Apprep.ChxApp*" -AND
|
||||
$_ -NotLike "*CBS*" -AND
|
||||
$_ -NotLike "*OOBENetworkCaptivePortal*" -AND
|
||||
$_ -NotLike "*PeopleExperienceHost*" -AND
|
||||
$_ -NotLike "*ParentalControls*" -AND
|
||||
$_ -NotLike "*Win32WebViewHost*" -AND
|
||||
$_ -NotLike "*InputApp*" -AND
|
||||
$_ -NotLike "*AccountsControl*" -AND
|
||||
$_ -NotLike "*AsyncTextService*" -AND
|
||||
$_ -NotLike "*CapturePicker*" -AND
|
||||
$_ -NotLike "*CredDialogHost*" -AND
|
||||
$_ -NotLike "*BioEnrollMent*" -AND
|
||||
$_ -NotLike "*ShellExperienceHost*" -AND
|
||||
$_ -NotLike "*DesktopAppInstaller*" -AND
|
||||
$_ -NotLike "*WebMediaExtensions*" -AND
|
||||
$_ -NotLike "*WMIC*" -AND
|
||||
$_ -NotLike "*UI.XaML*" -AND
|
||||
$_ -NotLike "*Ethernet*" -AND
|
||||
$_ -NotLike "*Wifi*"
|
||||
}
|
||||
|
||||
$failedCount = 0
|
||||
|
||||
foreach ($pkg in $pkglist) {
|
||||
try {
|
||||
$status = "Removing $pkg"
|
||||
Write-Progress -Activity "Removing Apps" -Status $status -PercentComplete ($counter++/$pkglist.Count*100)
|
||||
Remove-WindowsPackage -Path "$scratchDir" -PackageName $pkg -NoRestart -ErrorAction SilentlyContinue
|
||||
} catch {
|
||||
# This can happen if the package that is being removed is a permanent one, like FodMetadata
|
||||
Write-Host "Could not remove OS package $($pkg)"
|
||||
$failedCount += 1
|
||||
continue
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed
|
||||
if ($failedCount -gt 0)
|
||||
{
|
||||
Write-Host "Some packages could not be removed. Do not worry: your image will still work fine. This can happen if the package is permanent or has been superseded by a newer one."
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Unable to get information about the packages. MicroWin processing will continue, but packages will not be processed"
|
||||
Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
function Remove-ProvisionedPackages() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes AppX packages from a Windows image during MicroWin processing
|
||||
|
||||
.PARAMETER Name
|
||||
No Params
|
||||
|
||||
.EXAMPLE
|
||||
Remove-ProvisionedPackages
|
||||
#>
|
||||
try
|
||||
{
|
||||
$appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object {
|
||||
$_.PackageName -NotLike "*AppInstaller*" -AND
|
||||
$_.PackageName -NotLike "*Store*" -and
|
||||
$_.PackageName -NotLike "*dism*" -and
|
||||
$_.PackageName -NotLike "*Foundation*" -and
|
||||
$_.PackageName -NotLike "*FodMetadata*" -and
|
||||
$_.PackageName -NotLike "*LanguageFeatures*" -and
|
||||
$_.PackageName -NotLike "*Notepad*" -and
|
||||
$_.PackageName -NotLike "*Printing*" -and
|
||||
$_.PackageName -NotLike "*Foundation*" -and
|
||||
$_.PackageName -NotLike "*YourPhone*" -and
|
||||
$_.PackageName -NotLike "*Xbox*" -and
|
||||
$_.PackageName -NotLike "*WindowsTerminal*" -and
|
||||
$_.PackageName -NotLike "*Calculator*" -and
|
||||
$_.PackageName -NotLike "*Photos*" -and
|
||||
$_.PackageName -NotLike "*VCLibs*" -and
|
||||
$_.PackageName -NotLike "*Paint*" -and
|
||||
$_.PackageName -NotLike "*Gaming*" -and
|
||||
$_.PackageName -NotLike "*Extension*" -and
|
||||
$_.PackageName -NotLike "*SecHealthUI*"
|
||||
}
|
||||
|
||||
$counter = 0
|
||||
foreach ($appx in $appxProvisionedPackages) {
|
||||
$status = "Removing Provisioned $($appx.PackageName)"
|
||||
Write-Progress -Activity "Removing Provisioned Apps" -Status $status -PercentComplete ($counter++/$appxProvisionedPackages.Count*100)
|
||||
try {
|
||||
Remove-AppxProvisionedPackage -Path "$scratchDir" -PackageName $appx.PackageName -ErrorAction SilentlyContinue
|
||||
} catch {
|
||||
Write-Host "Application $($appx.PackageName) could not be removed"
|
||||
continue
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed
|
||||
}
|
||||
catch
|
||||
{
|
||||
# This can happen if getting AppX packages fails
|
||||
Write-Host "Unable to get information about the AppX packages. MicroWin processing will continue, but AppX packages will not be processed"
|
||||
Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
function Copy-ToUSB([string]$fileToCopy) {
|
||||
foreach ($volume in Get-Volume) {
|
||||
if ($volume -and $volume.FileSystemLabel -ieq "ventoy") {
|
||||
$destinationPath = "$($volume.DriveLetter):\"
|
||||
#Copy-Item -Path $fileToCopy -Destination $destinationPath -Force
|
||||
# Get the total size of the file
|
||||
$totalSize = (Get-Item "$fileToCopy").length
|
||||
|
||||
Copy-Item -Path "$fileToCopy" -Destination "$destinationPath" -Verbose -Force -Recurse -Container -PassThru |
|
||||
ForEach-Object {
|
||||
# Calculate the percentage completed
|
||||
$completed = ($_.BytesTransferred / $totalSize) * 100
|
||||
|
||||
# Display the progress bar
|
||||
Write-Progress -Activity "Copying File" -Status "Progress" -PercentComplete $completed -CurrentOperation ("{0:N2} MB / {1:N2} MB" -f ($_.BytesTransferred / 1MB), ($totalSize / 1MB))
|
||||
}
|
||||
|
||||
Write-Host "File copied to Ventoy drive $($volume.DriveLetter)"
|
||||
return
|
||||
}
|
||||
}
|
||||
Write-Host "Ventoy USB Key is not inserted"
|
||||
}
|
||||
|
||||
function Remove-FileOrDirectory([string]$pathToDelete, [string]$mask = "", [switch]$Directory = $false) {
|
||||
if(([string]::IsNullOrEmpty($pathToDelete))) { return }
|
||||
if (-not (Test-Path -Path "$($pathToDelete)")) { return }
|
||||
|
||||
$yesNo = Get-LocalizedYesNo
|
||||
Write-Host "[INFO] In Your local takeown expects '$($yesNo[0])' as a Yes answer."
|
||||
|
||||
$itemsToDelete = [System.Collections.ArrayList]::new()
|
||||
|
||||
if ($mask -eq "") {
|
||||
Write-Debug "Adding $($pathToDelete) to array."
|
||||
[void]$itemsToDelete.Add($pathToDelete)
|
||||
} else {
|
||||
Write-Debug "Adding $($pathToDelete) to array and mask is $($mask)"
|
||||
if ($Directory) { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse -Directory } else { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse }
|
||||
}
|
||||
|
||||
foreach($itemToDelete in $itemsToDelete) {
|
||||
$status = "Deleting $($itemToDelete)"
|
||||
Write-Progress -Activity "Removing Items" -Status $status -PercentComplete ($counter++/$itemsToDelete.Count*100)
|
||||
|
||||
if (Test-Path -Path "$($itemToDelete)" -PathType Container) {
|
||||
$status = "Deleting directory: $($itemToDelete)"
|
||||
|
||||
takeown /r /d $yesNo[0] /a /f "$($itemToDelete)"
|
||||
icacls "$($itemToDelete)" /q /c /t /reset
|
||||
icacls $itemToDelete /setowner "*S-1-5-32-544"
|
||||
icacls $itemToDelete /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
|
||||
Remove-Item -Force -Recurse "$($itemToDelete)"
|
||||
}
|
||||
elseif (Test-Path -Path "$($itemToDelete)" -PathType Leaf) {
|
||||
$status = "Deleting file: $($itemToDelete)"
|
||||
|
||||
takeown /a /f "$($itemToDelete)"
|
||||
icacls "$($itemToDelete)" /q /c /t /reset
|
||||
icacls "$($itemToDelete)" /setowner "*S-1-5-32-544"
|
||||
icacls "$($itemToDelete)" /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
|
||||
Remove-Item -Force "$($itemToDelete)"
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Items" -Status "Ready" -Completed
|
||||
}
|
||||
|
||||
function New-Unattend {
|
||||
function Microwin-NewUnattend {
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory, Position = 0)] [string]$userName,
|
||||
@ -289,7 +31,7 @@ function New-Unattend {
|
||||
<Group>Administrators</Group>
|
||||
<Password>
|
||||
<Value>PW-REPLACEME</Value>
|
||||
<PlainText>true</PlainText>
|
||||
<PlainText>PT-STATUS</PlainText>
|
||||
</Password>
|
||||
</LocalAccount>
|
||||
</LocalAccounts>
|
||||
@ -300,7 +42,7 @@ function New-Unattend {
|
||||
<LogonCount>1</LogonCount>
|
||||
<Password>
|
||||
<Value>PW-REPLACEME</Value>
|
||||
<PlainText>true</PlainText>
|
||||
<PlainText>PT-STATUS</PlainText>
|
||||
</Password>
|
||||
</AutoLogon>
|
||||
<OOBE>
|
||||
@ -418,320 +160,168 @@ function New-Unattend {
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>19</Order>
|
||||
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\remove-packages.ps1' -Raw | Invoke-Expression;"</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>20</Order>
|
||||
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\remove-caps.ps1' -Raw | Invoke-Expression;"</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>21</Order>
|
||||
<Path>reg.exe add "HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v ConfigureStartPins /t REG_SZ /d "{ \"pinnedList\": [] }" /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>22</Order>
|
||||
<Order>20</Order>
|
||||
<Path>reg.exe add "HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v ConfigureStartPins_ProviderSet /t REG_DWORD /d 1 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>23</Order>
|
||||
<Order>21</Order>
|
||||
<Path>reg.exe add "HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v ConfigureStartPins_WinningProvider /t REG_SZ /d B5292708-1619-419B-9923-E5D9F3925E71 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>24</Order>
|
||||
<Order>22</Order>
|
||||
<Path>reg.exe add "HKLM\SOFTWARE\Microsoft\PolicyManager\providers\B5292708-1619-419B-9923-E5D9F3925E71\default\Device\Start" /v ConfigureStartPins /t REG_SZ /d "{ \"pinnedList\": [] }" /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>25</Order>
|
||||
<Order>23</Order>
|
||||
<Path>reg.exe add "HKLM\SOFTWARE\Microsoft\PolicyManager\providers\B5292708-1619-419B-9923-E5D9F3925E71\default\Device\Start" /v ConfigureStartPins_LastWrite /t REG_DWORD /d 1 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>26</Order>
|
||||
<Order>24</Order>
|
||||
<Path>net.exe accounts /maxpwage:UNLIMITED</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>27</Order>
|
||||
<Order>25</Order>
|
||||
<Path>reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>28</Order>
|
||||
<Order>26</Order>
|
||||
<Path>reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>29</Order>
|
||||
<Order>27</Order>
|
||||
<Path>reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>30</Order>
|
||||
<Order>28</Order>
|
||||
<Path>reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>31</Order>
|
||||
<Order>29</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "ContentDeliveryAllowed" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>32</Order>
|
||||
<Order>30</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "FeatureManagementEnabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>33</Order>
|
||||
<Order>31</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "OEMPreInstalledAppsEnabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>34</Order>
|
||||
<Order>32</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEnabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>35</Order>
|
||||
<Order>33</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEverEnabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>36</Order>
|
||||
<Order>34</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SilentInstalledAppsEnabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>37</Order>
|
||||
<Order>35</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SoftLandingEnabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>38</Order>
|
||||
<Order>36</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContentEnabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>39</Order>
|
||||
<Order>37</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-310093Enabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>40</Order>
|
||||
<Order>38</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338387Enabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>41</Order>
|
||||
<Order>39</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338388Enabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>42</Order>
|
||||
<Order>40</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338389Enabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>43</Order>
|
||||
<Order>41</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338393Enabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>44</Order>
|
||||
<Order>42</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-353698Enabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>45</Order>
|
||||
<Order>43</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SystemPaneSuggestionsEnabled" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>46</Order>
|
||||
<Order>44</Order>
|
||||
<Path>reg.exe unload "HKU\DefaultUser"</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>47</Order>
|
||||
<Order>45</Order>
|
||||
<Path>reg.exe add "HKLM\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d 0 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>48</Order>
|
||||
<Order>46</Order>
|
||||
<Path>reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\BitLocker" /v "PreventDeviceEncryption" /t REG_DWORD /d 1 /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>49</Order>
|
||||
<Order>47</Order>
|
||||
<Path>reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>50</Order>
|
||||
<Order>48</Order>
|
||||
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Runonce" /v "ClassicContextMenu" /t REG_SZ /d "reg.exe add \"HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32\" /ve /f" /f</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>51</Order>
|
||||
<Order>49</Order>
|
||||
<Path>reg.exe unload "HKU\DefaultUser"</Path>
|
||||
</RunSynchronousCommand>
|
||||
</RunSynchronous>
|
||||
</component>
|
||||
</settings>
|
||||
'@
|
||||
if ((Test-CompatibleImage $imgVersion $([System.Version]::new(10,0,22000,1))) -eq $false) {
|
||||
# Replace the placeholder text with an empty string to make it valid for Windows 10 Setup
|
||||
$unattend = $unattend.Replace("<#REPLACEME#>", "").Trim()
|
||||
if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,22000,1))) -eq $false) {
|
||||
# Replace the placeholder text with an empty string to make it valid for Windows 10 Setup
|
||||
$unattend = $unattend.Replace("<#REPLACEME#>", "").Trim()
|
||||
} else {
|
||||
# Replace the placeholder text with the Specialize pass
|
||||
$unattend = $unattend.Replace("<#REPLACEME#>", $specPass).Trim()
|
||||
# Replace the placeholder text with the Specialize pass
|
||||
$unattend = $unattend.Replace("<#REPLACEME#>", $specPass).Trim()
|
||||
}
|
||||
|
||||
# User password in Base64. According to Microsoft, this is the way you can hide this sensitive information.
|
||||
# More information can be found here: https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/wsim/hide-sensitive-data-in-an-answer-file
|
||||
# Yeah, I know this is not the best way to protect this kind of data, but we all know how Microsoft is - "the Apple of security" (in a sense, it takes them
|
||||
# an eternity to implement basic security features right. Just look at the NTLM and Kerberos situation!)
|
||||
|
||||
$b64pass = ""
|
||||
|
||||
# Replace default User and Password values with the provided parameters
|
||||
$unattend = $unattend.Replace("USER-REPLACEME", $userName).Trim()
|
||||
$unattend = $unattend.Replace("PW-REPLACEME", $userPassword).Trim()
|
||||
try {
|
||||
# I want to play it safe here - I don't want encoding mismatch problems like last time
|
||||
|
||||
# NOTE: "Password" needs to be appended to the password specified by the user. Otherwise, a parse error will occur when processing oobeSystem.
|
||||
# This will not be added to the actual password stored in the target system's SAM file - only the provided password
|
||||
$b64pass = [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes("$($userPassword)Password"))
|
||||
} catch {
|
||||
$b64pass = ""
|
||||
}
|
||||
if ($b64pass -ne "") {
|
||||
# If we could encode the password with Base64, put it in the answer file and indicate that it's NOT in plain text
|
||||
$unattend = $unattend.Replace("PW-REPLACEME", $b64pass).Trim()
|
||||
$unattend = $unattend.Replace("PT-STATUS", "false").Trim()
|
||||
$b64pass = ""
|
||||
} else {
|
||||
$unattend = $unattend.Replace("PW-REPLACEME", $userPassword).Trim()
|
||||
$unattend = $unattend.Replace("PT-STATUS", "true").Trim()
|
||||
}
|
||||
|
||||
# Save unattended answer file with UTF-8 encoding
|
||||
$unattend | Out-File -FilePath "$env:temp\unattend.xml" -Force -Encoding utf8
|
||||
}
|
||||
|
||||
function New-CheckInstall {
|
||||
|
||||
# using here string to embedd firstrun
|
||||
$checkInstall = @'
|
||||
@echo off
|
||||
if exist "C:\windows\cpu.txt" (
|
||||
echo C:\windows\cpu.txt exists
|
||||
) else (
|
||||
echo C:\windows\cpu.txt does not exist
|
||||
)
|
||||
if exist "C:\windows\SerialNumber.txt" (
|
||||
echo C:\windows\SerialNumber.txt exists
|
||||
) else (
|
||||
echo C:\windows\SerialNumber.txt does not exist
|
||||
)
|
||||
if exist "C:\unattend.xml" (
|
||||
echo C:\unattend.xml exists
|
||||
) else (
|
||||
echo C:\unattend.xml does not exist
|
||||
)
|
||||
if exist "C:\Windows\Setup\Scripts\SetupComplete.cmd" (
|
||||
echo C:\Windows\Setup\Scripts\SetupComplete.cmd exists
|
||||
) else (
|
||||
echo C:\Windows\Setup\Scripts\SetupComplete.cmd does not exist
|
||||
)
|
||||
if exist "C:\Windows\Panther\unattend.xml" (
|
||||
echo C:\Windows\Panther\unattend.xml exists
|
||||
) else (
|
||||
echo C:\Windows\Panther\unattend.xml does not exist
|
||||
)
|
||||
if exist "C:\Windows\System32\Sysprep\unattend.xml" (
|
||||
echo C:\Windows\System32\Sysprep\unattend.xml exists
|
||||
) else (
|
||||
echo C:\Windows\System32\Sysprep\unattend.xml does not exist
|
||||
)
|
||||
if exist "C:\Windows\FirstStartup.ps1" (
|
||||
echo C:\Windows\FirstStartup.ps1 exists
|
||||
) else (
|
||||
echo C:\Windows\FirstStartup.ps1 does not exist
|
||||
)
|
||||
if exist "C:\Windows\winutil.ps1" (
|
||||
echo C:\Windows\winutil.ps1 exists
|
||||
) else (
|
||||
echo C:\Windows\winutil.ps1 does not exist
|
||||
)
|
||||
if exist "C:\Windows\LogSpecialize.txt" (
|
||||
echo C:\Windows\LogSpecialize.txt exists
|
||||
) else (
|
||||
echo C:\Windows\LogSpecialize.txt does not exist
|
||||
)
|
||||
if exist "C:\Windows\LogAuditUser.txt" (
|
||||
echo C:\Windows\LogAuditUser.txt exists
|
||||
) else (
|
||||
echo C:\Windows\LogAuditUser.txt does not exist
|
||||
)
|
||||
if exist "C:\Windows\LogOobeSystem.txt" (
|
||||
echo C:\Windows\LogOobeSystem.txt exists
|
||||
) else (
|
||||
echo C:\Windows\LogOobeSystem.txt does not exist
|
||||
)
|
||||
if exist "c:\windows\csup.txt" (
|
||||
echo c:\windows\csup.txt exists
|
||||
) else (
|
||||
echo c:\windows\csup.txt does not exist
|
||||
)
|
||||
if exist "c:\windows\LogFirstRun.txt" (
|
||||
echo c:\windows\LogFirstRun.txt exists
|
||||
) else (
|
||||
echo c:\windows\LogFirstRun.txt does not exist
|
||||
)
|
||||
'@
|
||||
$checkInstall | Out-File -FilePath "$env:temp\checkinstall.cmd" -Force -Encoding Ascii
|
||||
}
|
||||
|
||||
function New-FirstRun {
|
||||
|
||||
# using here string to embedd firstrun
|
||||
$firstRun = @'
|
||||
# Set the global error action preference to continue
|
||||
$ErrorActionPreference = "Continue"
|
||||
function Remove-RegistryValue {
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$RegistryPath,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$ValueName
|
||||
)
|
||||
|
||||
# Check if the registry path exists
|
||||
if (Test-Path -Path $RegistryPath) {
|
||||
$registryValue = Get-ItemProperty -Path $RegistryPath -Name $ValueName -ErrorAction SilentlyContinue
|
||||
|
||||
# Check if the registry value exists
|
||||
if ($registryValue) {
|
||||
# Remove the registry value
|
||||
Remove-ItemProperty -Path $RegistryPath -Name $ValueName -Force
|
||||
Write-Host "Registry value '$ValueName' removed from '$RegistryPath'."
|
||||
} else {
|
||||
Write-Host "Registry value '$ValueName' not found in '$RegistryPath'."
|
||||
}
|
||||
} else {
|
||||
Write-Host "Registry path '$RegistryPath' not found."
|
||||
}
|
||||
}
|
||||
|
||||
"FirstStartup has worked" | Out-File -FilePath c:\windows\LogFirstRun.txt -Append -NoClobber
|
||||
|
||||
$taskbarPath = "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
|
||||
# Delete all files on the Taskbar
|
||||
Get-ChildItem -Path $taskbarPath -File | Remove-Item -Force
|
||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesRemovedChanges"
|
||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesChanges"
|
||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "Favorites"
|
||||
|
||||
# Delete Edge Icon from the desktop
|
||||
$edgeShortcutFiles = Get-ChildItem -Path $desktopPath -Filter "*Edge*.lnk"
|
||||
# Check if Edge shortcuts exist on the desktop
|
||||
if ($edgeShortcutFiles) {
|
||||
foreach ($shortcutFile in $edgeShortcutFiles) {
|
||||
# Remove each Edge shortcut
|
||||
Remove-Item -Path $shortcutFile.FullName -Force
|
||||
Write-Host "Edge shortcut '$($shortcutFile.Name)' removed from the desktop."
|
||||
}
|
||||
}
|
||||
Remove-Item -Path "$env:USERPROFILE\Desktop\*.lnk"
|
||||
Remove-Item -Path "C:\Users\Default\Desktop\*.lnk"
|
||||
|
||||
# ************************************************
|
||||
# Create WinUtil shortcut on the desktop
|
||||
#
|
||||
$desktopPath = "$($env:USERPROFILE)\Desktop"
|
||||
# Specify the target PowerShell command
|
||||
$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"
|
||||
}
|
||||
|
||||
# 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
|
||||
}
|
82
functions/microwin/Microwin-RemoveFeatures.ps1
Normal file
82
functions/microwin/Microwin-RemoveFeatures.ps1
Normal file
@ -0,0 +1,82 @@
|
||||
function Microwin-RemoveFeatures() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes certain features from ISO image
|
||||
|
||||
.PARAMETER UseCmdlets
|
||||
Determines whether or not to use the DISM cmdlets for processing.
|
||||
- If true, DISM cmdlets will be used
|
||||
- If false, calls to the DISM executable will be made whilst selecting bits and pieces from the output as a string (that was how MicroWin worked before
|
||||
the DISM conversion to cmdlets)
|
||||
|
||||
.EXAMPLE
|
||||
Microwin-RemoveFeatures -UseCmdlets $true
|
||||
#>
|
||||
param (
|
||||
[Parameter(Mandatory = $true, Position = 0)] [bool]$UseCmdlets
|
||||
)
|
||||
try {
|
||||
if ($UseCmdlets) {
|
||||
$featlist = (Get-WindowsOptionalFeature -Path "$scratchDir")
|
||||
|
||||
$featlist = $featlist | Where-Object {
|
||||
$_.FeatureName -NotLike "*Defender*" -AND
|
||||
$_.FeatureName -NotLike "*Printing*" -AND
|
||||
$_.FeatureName -NotLike "*TelnetClient*" -AND
|
||||
$_.FeatureName -NotLike "*PowerShell*" -AND
|
||||
$_.FeatureName -NotLike "*NetFx*" -AND
|
||||
$_.FeatureName -NotLike "*Media*" -AND
|
||||
$_.FeatureName -NotLike "*NFS*" -AND
|
||||
$_.FeatureName -NotLike "*SearchEngine*" -AND
|
||||
$_.FeatureName -NotLike "*RemoteDesktop*" -AND
|
||||
$_.State -ne "Disabled"
|
||||
}
|
||||
} else {
|
||||
$featList = dism /english /image="$scratchDir" /get-features | Select-String -Pattern "Feature Name : " -CaseSensitive -SimpleMatch
|
||||
if ($?) {
|
||||
$featList = $featList -split "Feature Name : " | Where-Object {$_}
|
||||
# Exclude the same items. Note: for now, this doesn't exclude those features that are disabled.
|
||||
# This will appear in the future
|
||||
$featList = $featList | Where-Object {
|
||||
$_ -NotLike "*Defender*" -AND
|
||||
$_ -NotLike "*Printing*" -AND
|
||||
$_ -NotLike "*TelnetClient*" -AND
|
||||
$_ -NotLike "*PowerShell*" -AND
|
||||
$_ -NotLike "*NetFx*" -AND
|
||||
$_ -NotLike "*Media*" -AND
|
||||
$_ -NotLike "*NFS*" -AND
|
||||
$_ -NotLike "*SearchEngine*" -AND
|
||||
$_ -NotLike "*RemoteDesktop*"
|
||||
}
|
||||
} else {
|
||||
Write-Host "Features could not be obtained with DISM. MicroWin processing will continue, but features will be skipped."
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if ($UseCmdlets) {
|
||||
foreach ($feature in $featList) {
|
||||
$status = "Removing feature $($feature.FeatureName)"
|
||||
Write-Progress -Activity "Removing features" -Status $status -PercentComplete ($counter++/$featlist.Count*100)
|
||||
Write-Debug "Removing feature $($feature.FeatureName)"
|
||||
Disable-WindowsOptionalFeature -Path "$scratchDir" -FeatureName $($feature.FeatureName) -Remove -ErrorAction SilentlyContinue -NoRestart
|
||||
}
|
||||
} else {
|
||||
foreach ($feature in $featList) {
|
||||
$status = "Removing feature $feature"
|
||||
Write-Progress -Activity "Removing features" -Status $status -PercentComplete ($counter++/$featlist.Count*100)
|
||||
Write-Debug "Removing feature $feature"
|
||||
dism /english /image="$scratchDir" /disable-feature /featurename=$feature /remove /quiet /norestart | Out-Null
|
||||
if ($? -eq $false) {
|
||||
Write-Host "Feature $feature could not be disabled."
|
||||
}
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing features" -Status "Ready" -Completed
|
||||
Write-Host "You can re-enable the disabled features at any time, using either Windows Update or the SxS folder in <installation media>\Sources."
|
||||
} catch {
|
||||
Write-Host "Unable to get information about the features. A fallback will be used..."
|
||||
Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
Microwin-RemoveFeatures -UseCmdlets $false
|
||||
}
|
||||
}
|
46
functions/microwin/Microwin-RemoveFileOrDirectory.ps1
Normal file
46
functions/microwin/Microwin-RemoveFileOrDirectory.ps1
Normal file
@ -0,0 +1,46 @@
|
||||
function Microwin-RemoveFileOrDirectory([string]$pathToDelete, [string]$mask = "", [switch]$Directory = $false) {
|
||||
if(([string]::IsNullOrEmpty($pathToDelete))) { return }
|
||||
if (-not (Test-Path -Path "$($pathToDelete)")) { return }
|
||||
|
||||
$yesNo = Get-LocalizedYesNo
|
||||
Write-Host "[INFO] In Your local takeown expects '$($yesNo[0])' as a Yes answer."
|
||||
|
||||
$itemsToDelete = [System.Collections.ArrayList]::new()
|
||||
|
||||
if ($mask -eq "") {
|
||||
Write-Debug "Adding $($pathToDelete) to array."
|
||||
[void]$itemsToDelete.Add($pathToDelete)
|
||||
} else {
|
||||
Write-Debug "Adding $($pathToDelete) to array and mask is $($mask)"
|
||||
if ($Directory) {
|
||||
$itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse -Directory
|
||||
} else {
|
||||
$itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse
|
||||
}
|
||||
}
|
||||
|
||||
foreach($itemToDelete in $itemsToDelete) {
|
||||
$status = "Deleting $($itemToDelete)"
|
||||
Write-Progress -Activity "Removing Items" -Status $status -PercentComplete ($counter++/$itemsToDelete.Count*100)
|
||||
|
||||
if (Test-Path -Path "$($itemToDelete)" -PathType Container) {
|
||||
$status = "Deleting directory: $($itemToDelete)"
|
||||
|
||||
takeown /r /d $yesNo[0] /a /f "$($itemToDelete)"
|
||||
icacls "$($itemToDelete)" /q /c /t /reset
|
||||
icacls $itemToDelete /setowner "*S-1-5-32-544"
|
||||
icacls $itemToDelete /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
|
||||
Remove-Item -Force -Recurse "$($itemToDelete)"
|
||||
}
|
||||
elseif (Test-Path -Path "$($itemToDelete)" -PathType Leaf) {
|
||||
$status = "Deleting file: $($itemToDelete)"
|
||||
|
||||
takeown /a /f "$($itemToDelete)"
|
||||
icacls "$($itemToDelete)" /q /c /t /reset
|
||||
icacls "$($itemToDelete)" /setowner "*S-1-5-32-544"
|
||||
icacls "$($itemToDelete)" /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
|
||||
Remove-Item -Force "$($itemToDelete)"
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Items" -Status "Ready" -Completed
|
||||
}
|
129
functions/microwin/Microwin-RemovePackages.ps1
Normal file
129
functions/microwin/Microwin-RemovePackages.ps1
Normal file
@ -0,0 +1,129 @@
|
||||
function Microwin-RemovePackages {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes certain packages from ISO image
|
||||
|
||||
.PARAMETER UseCmdlets
|
||||
Determines whether or not to use the DISM cmdlets for processing.
|
||||
- If true, DISM cmdlets will be used
|
||||
- If false, calls to the DISM executable will be made whilst selecting bits and pieces from the output as a string (that was how MicroWin worked before
|
||||
the DISM conversion to cmdlets)
|
||||
|
||||
.EXAMPLE
|
||||
Microwin-RemovePackages -UseCmdlets $true
|
||||
#>
|
||||
param (
|
||||
[Parameter(Mandatory = $true, Position = 0)] [bool]$UseCmdlets
|
||||
)
|
||||
try {
|
||||
if ($useCmdlets) {
|
||||
$pkglist = (Get-WindowsPackage -Path "$scratchDir").PackageName
|
||||
|
||||
$pkglist = $pkglist | Where-Object {
|
||||
$_ -NotLike "*ApplicationModel*" -AND
|
||||
$_ -NotLike "*indows-Client-LanguagePack*" -AND
|
||||
$_ -NotLike "*LanguageFeatures-Basic*" -AND
|
||||
$_ -NotLike "*Package_for_ServicingStack*" -AND
|
||||
$_ -NotLike "*DotNet*" -AND
|
||||
$_ -NotLike "*Notepad*" -AND
|
||||
$_ -NotLike "*WMIC*" -AND
|
||||
$_ -NotLike "*Ethernet*" -AND
|
||||
$_ -NotLike "*Wifi*" -AND
|
||||
$_ -NotLike "*FodMetadata*" -AND
|
||||
$_ -NotLike "*Foundation*" -AND
|
||||
$_ -NotLike "*LanguageFeatures*" -AND
|
||||
$_ -NotLike "*VBSCRIPT*" -AND
|
||||
$_ -NotLike "*License*" -AND
|
||||
$_ -NotLike "*Hello-Face*" -AND
|
||||
$_ -NotLike "*ISE*" -AND
|
||||
$_ -NotLike "*OpenSSH*"
|
||||
}
|
||||
} else {
|
||||
$pkgList = dism /english /image="$scratchDir" /get-packages | Select-String -Pattern "Package Identity : " -CaseSensitive -SimpleMatch
|
||||
if ($?) {
|
||||
$pkgList = $pkgList -split "Package Identity : " | Where-Object {$_}
|
||||
# Exclude the same items.
|
||||
$pkgList = $pkgList | Where-Object {
|
||||
$_ -NotLike "*ApplicationModel*" -AND
|
||||
$_ -NotLike "*indows-Client-LanguagePack*" -AND
|
||||
$_ -NotLike "*LanguageFeatures-Basic*" -AND
|
||||
$_ -NotLike "*Package_for_ServicingStack*" -AND
|
||||
$_ -NotLike "*DotNet*" -AND
|
||||
$_ -NotLike "*Notepad*" -AND
|
||||
$_ -NotLike "*WMIC*" -AND
|
||||
$_ -NotLike "*Ethernet*" -AND
|
||||
$_ -NotLike "*Wifi*" -AND
|
||||
$_ -NotLike "*FodMetadata*" -AND
|
||||
$_ -NotLike "*Foundation*" -AND
|
||||
$_ -NotLike "*LanguageFeatures*" -AND
|
||||
$_ -NotLike "*VBSCRIPT*" -AND
|
||||
$_ -NotLike "*License*" -AND
|
||||
$_ -NotLike "*Hello-Face*" -AND
|
||||
$_ -NotLike "*ISE*" -AND
|
||||
$_ -NotLike "*OpenSSH*"
|
||||
}
|
||||
} else {
|
||||
Write-Host "Packages could not be obtained with DISM. MicroWin processing will continue, but packages will be skipped."
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if ($UseCmdlets) {
|
||||
$failedCount = 0
|
||||
|
||||
$erroredPackages = [System.Collections.Generic.List[ErroredPackage]]::new()
|
||||
|
||||
foreach ($pkg in $pkglist) {
|
||||
try {
|
||||
$status = "Removing $pkg"
|
||||
Write-Progress -Activity "Removing Packages" -Status $status -PercentComplete ($counter++/$pkglist.Count*100)
|
||||
Remove-WindowsPackage -Path "$scratchDir" -PackageName $pkg -NoRestart -ErrorAction SilentlyContinue
|
||||
} catch {
|
||||
# This can happen if the package that is being removed is a permanent one
|
||||
$erroredPackages.Add([ErroredPackage]::new($pkg, $_.Exception.Message))
|
||||
$failedCount += 1
|
||||
continue
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($package in $pkgList) {
|
||||
$status = "Removing package $package"
|
||||
Write-Progress -Activity "Removing Packages" -Status $status -PercentComplete ($counter++/$pkglist.Count*100)
|
||||
Write-Debug "Removing package $package"
|
||||
dism /english /image="$scratchDir" /remove-package /packagename=$package /quiet /norestart | Out-Null
|
||||
if ($? -eq $false) {
|
||||
Write-Host "Package $package could not be removed."
|
||||
}
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Packages" -Status "Ready" -Completed
|
||||
if ($UseCmdlets -and $failedCount -gt 0)
|
||||
{
|
||||
Write-Host "$failedCount package(s) could not be removed. Your image will still work fine, however. Below is information on what packages failed to be removed and why."
|
||||
if ($erroredPackages.Count -gt 0)
|
||||
{
|
||||
$erroredPackages = $erroredPackages | Sort-Object -Property ErrorMessage
|
||||
|
||||
$previousErroredPackage = $erroredPackages[0]
|
||||
$counter = 0
|
||||
Write-Host ""
|
||||
Write-Host "- $($previousErroredPackage.ErrorMessage)"
|
||||
foreach ($erroredPackage in $erroredPackages) {
|
||||
if ($erroredPackage.ErrorMessage -ne $previousErroredPackage.ErrorMessage) {
|
||||
Write-Host ""
|
||||
$counter = 0
|
||||
Write-Host "- $($erroredPackage.ErrorMessage)"
|
||||
}
|
||||
$counter += 1
|
||||
Write-Host " $counter) $($erroredPackage.PackageName)"
|
||||
$previousErroredPackage = $erroredPackage
|
||||
}
|
||||
Write-Host ""
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Unable to get information about the packages. A fallback will be used..."
|
||||
Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
Microwin-RemovePackages -UseCmdlets $false
|
||||
}
|
||||
}
|
96
functions/microwin/Microwin-RemoveProvisionedPackages.ps1
Normal file
96
functions/microwin/Microwin-RemoveProvisionedPackages.ps1
Normal file
@ -0,0 +1,96 @@
|
||||
function Microwin-RemoveProvisionedPackages() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes AppX packages from a Windows image during MicroWin processing
|
||||
|
||||
.PARAMETER UseCmdlets
|
||||
Determines whether or not to use the DISM cmdlets for processing.
|
||||
- If true, DISM cmdlets will be used
|
||||
- If false, calls to the DISM executable will be made whilst selecting bits and pieces from the output as a string (that was how MicroWin worked before
|
||||
the DISM conversion to cmdlets)
|
||||
|
||||
.EXAMPLE
|
||||
Microwin-RemoveProvisionedPackages
|
||||
#>
|
||||
param (
|
||||
[Parameter(Mandatory = $true, Position = 0)] [bool]$UseCmdlets
|
||||
)
|
||||
try
|
||||
{
|
||||
if ($UseCmdlets) {
|
||||
$appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object {
|
||||
$_.PackageName -NotLike "*AppInstaller*" -AND
|
||||
$_.PackageName -NotLike "*Store*" -and
|
||||
$_.PackageName -NotLike "*Notepad*" -and
|
||||
$_.PackageName -NotLike "*Printing*" -and
|
||||
$_.PackageName -NotLike "*YourPhone*" -and
|
||||
$_.PackageName -NotLike "*Xbox*" -and
|
||||
$_.PackageName -NotLike "*WindowsTerminal*" -and
|
||||
$_.PackageName -NotLike "*Calculator*" -and
|
||||
$_.PackageName -NotLike "*Photos*" -and
|
||||
$_.PackageName -NotLike "*VCLibs*" -and
|
||||
$_.PackageName -NotLike "*Paint*" -and
|
||||
$_.PackageName -NotLike "*Gaming*" -and
|
||||
$_.PackageName -NotLike "*Extension*" -and
|
||||
$_.PackageName -NotLike "*SecHealthUI*" -and
|
||||
$_.PackageName -NotLike "*ScreenSketch*"
|
||||
}
|
||||
} else {
|
||||
$appxProvisionedPackages = dism /english /image="$scratchDir" /get-provisionedappxpackages | Select-String -Pattern "PackageName : " -CaseSensitive -SimpleMatch
|
||||
if ($?) {
|
||||
$appxProvisionedPackages = $appxProvisionedPackages -split "PackageName : " | Where-Object {$_}
|
||||
# Exclude the same items.
|
||||
$appxProvisionedPackages = $appxProvisionedPackages | Where-Object {
|
||||
$_ -NotLike "*AppInstaller*" -AND
|
||||
$_ -NotLike "*Store*" -and
|
||||
$_ -NotLike "*Notepad*" -and
|
||||
$_ -NotLike "*Printing*" -and
|
||||
$_ -NotLike "*YourPhone*" -and
|
||||
$_ -NotLike "*Xbox*" -and
|
||||
$_ -NotLike "*WindowsTerminal*" -and
|
||||
$_ -NotLike "*Calculator*" -and
|
||||
$_ -NotLike "*Photos*" -and
|
||||
$_ -NotLike "*VCLibs*" -and
|
||||
$_ -NotLike "*Paint*" -and
|
||||
$_ -NotLike "*Gaming*" -and
|
||||
$_ -NotLike "*Extension*" -and
|
||||
$_ -NotLike "*SecHealthUI*" -and
|
||||
$_ -NotLike "*ScreenSketch*"
|
||||
}
|
||||
} else {
|
||||
Write-Host "AppX packages could not be obtained with DISM. MicroWin processing will continue, but AppX packages will be skipped."
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
$counter = 0
|
||||
if ($UseCmdlets) {
|
||||
foreach ($appx in $appxProvisionedPackages) {
|
||||
$status = "Removing Provisioned $($appx.PackageName)"
|
||||
Write-Progress -Activity "Removing Provisioned Apps" -Status $status -PercentComplete ($counter++/$appxProvisionedPackages.Count*100)
|
||||
try {
|
||||
Remove-AppxProvisionedPackage -Path "$scratchDir" -PackageName $appx.PackageName -ErrorAction SilentlyContinue
|
||||
} catch {
|
||||
Write-Host "Application $($appx.PackageName) could not be removed"
|
||||
continue
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($appx in $appxProvisionedPackages) {
|
||||
$status = "Removing Provisioned $appx"
|
||||
Write-Progress -Activity "Removing Provisioned Apps" -Status $status -PercentComplete ($counter++/$appxProvisionedPackages.Count*100)
|
||||
dism /english /image="$scratchDir" /remove-provisionedappxpackage /packagename=$appx /quiet /norestart | Out-Null
|
||||
if ($? -eq $false) {
|
||||
Write-Host "AppX package $appx could not be removed."
|
||||
}
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Host "Unable to get information about the AppX packages. A fallback will be used..."
|
||||
Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
Microwin-RemoveProvisionedPackages -UseCmdlets $false
|
||||
}
|
||||
}
|
26
functions/microwin/Microwin-TestCompatibleImage.ps1
Normal file
26
functions/microwin/Microwin-TestCompatibleImage.ps1
Normal file
@ -0,0 +1,26 @@
|
||||
function Microwin-TestCompatibleImage() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the version of a Windows image and determines whether or not it is compatible with a specific feature depending on a desired version
|
||||
|
||||
.PARAMETER Name
|
||||
imgVersion - The version of the Windows image
|
||||
desiredVersion - The version to compare the image version with
|
||||
#>
|
||||
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory, position=0)]
|
||||
[string]$imgVersion,
|
||||
|
||||
[Parameter(Mandatory, position=1)]
|
||||
[Version]$desiredVersion
|
||||
)
|
||||
|
||||
try {
|
||||
$version = [Version]$imgVersion
|
||||
return $version -ge $desiredVersion
|
||||
} catch {
|
||||
return $False
|
||||
}
|
||||
}
|
50
functions/private/Add-SelectedAppsMenuItem.ps1
Normal file
50
functions/private/Add-SelectedAppsMenuItem.ps1
Normal file
@ -0,0 +1,50 @@
|
||||
function Add-SelectedAppsMenuItem {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
This is a helper function that generates and adds the Menu Items to the Selected Apps Popup.
|
||||
|
||||
.Parameter name
|
||||
The actual Name of an App like "Chrome" or "Brave"
|
||||
This name is contained in the "Content" property inside the applications.json
|
||||
.PARAMETER key
|
||||
The key which identifies an app object in applications.json
|
||||
For Chrome this would be "WPFInstallchrome" because "WPFInstall" is prepended automatically for each key in applications.json
|
||||
#>
|
||||
|
||||
param ([string]$name, [string]$key)
|
||||
|
||||
$selectedAppGrid = New-Object Windows.Controls.Grid
|
||||
|
||||
$selectedAppGrid.ColumnDefinitions.Add((New-Object System.Windows.Controls.ColumnDefinition -Property @{Width = "*"}))
|
||||
$selectedAppGrid.ColumnDefinitions.Add((New-Object System.Windows.Controls.ColumnDefinition -Property @{Width = "30"}))
|
||||
|
||||
# Sets the name to the Content as well as the Tooltip, because the parent Popup Border has a fixed width and text could "overflow".
|
||||
# With the tooltip, you can still read the whole entry on hover
|
||||
$selectedAppLabel = New-Object Windows.Controls.Label
|
||||
$selectedAppLabel.Content = $name
|
||||
$selectedAppLabel.ToolTip = $name
|
||||
$selectedAppLabel.HorizontalAlignment = "Left"
|
||||
$selectedAppLabel.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
|
||||
[System.Windows.Controls.Grid]::SetColumn($selectedAppLabel, 0)
|
||||
$selectedAppGrid.Children.Add($selectedAppLabel)
|
||||
|
||||
$selectedAppRemoveButton = New-Object Windows.Controls.Button
|
||||
$selectedAppRemoveButton.FontFamily = "Segoe MDL2 Assets"
|
||||
$selectedAppRemoveButton.Content = [string]([char]0xE711)
|
||||
$selectedAppRemoveButton.HorizontalAlignment = "Center"
|
||||
$selectedAppRemoveButton.Tag = $key
|
||||
$selectedAppRemoveButton.ToolTip = "Remove the App from Selection"
|
||||
$selectedAppRemoveButton.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
|
||||
$selectedAppRemoveButton.SetResourceReference([Windows.Controls.Control]::StyleProperty, "HoverButtonStyle")
|
||||
|
||||
# Highlight the Remove icon on Hover
|
||||
$selectedAppRemoveButton.Add_MouseEnter({ $this.Foreground = "Red" })
|
||||
$selectedAppRemoveButton.Add_MouseLeave({ $this.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") })
|
||||
$selectedAppRemoveButton.Add_Click({
|
||||
$sync.($this.Tag).isChecked = $false # On click of the remove button, we only have to uncheck the corresponding checkbox. This will kick of all neccessary changes to update the UI
|
||||
})
|
||||
[System.Windows.Controls.Grid]::SetColumn($selectedAppRemoveButton, 1)
|
||||
$selectedAppGrid.Children.Add($selectedAppRemoveButton)
|
||||
# Add new Element to Popup
|
||||
$sync.selectedAppsstackPanel.Children.Add($selectedAppGrid)
|
||||
}
|
@ -2,11 +2,17 @@ function Copy-Files {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This function will make all modifications to the registry
|
||||
|
||||
Copies the contents of a given ISO file to a given destination
|
||||
.PARAMETER Path
|
||||
The source of the files to copy
|
||||
.PARAMETER Destination
|
||||
The destination to copy the files to
|
||||
.PARAMETER Recurse
|
||||
Determines whether or not to copy all files of the ISO file, including those in subdirectories
|
||||
.PARAMETER Force
|
||||
Determines whether or not to overwrite existing files
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
|
||||
Copy-Files "D:" "C:\ISOFile" -Recurse -Force
|
||||
|
||||
#>
|
||||
param (
|
||||
@ -19,11 +25,11 @@ function Copy-Files {
|
||||
try {
|
||||
|
||||
$files = Get-ChildItem -Path $path -Recurse:$recurse
|
||||
Write-Host "Copy $($files.Count)(s) from $path to $destination"
|
||||
Write-Host "Copy $($files.Count) file(s) from $path to $destination"
|
||||
|
||||
foreach ($file in $files) {
|
||||
$status = "Copy files {0} on {1}: {2}" -f $counter, $files.Count, $file.Name
|
||||
Write-Progress -Activity "Copy Windows files" -Status $status -PercentComplete ($counter++/$files.count*100)
|
||||
$status = "Copying file {0} of {1}: {2}" -f $counter, $files.Count, $file.Name
|
||||
Write-Progress -Activity "Copy disc image files" -Status $status -PercentComplete ($counter++/$files.count*100)
|
||||
$restpath = $file.FullName -Replace $path, ''
|
||||
|
||||
if ($file.PSIsContainer -eq $true) {
|
||||
@ -35,9 +41,13 @@ function Copy-Files {
|
||||
Set-ItemProperty -Path ($destination+$restpath) -Name IsReadOnly -Value $false
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Copy Windows files" -Status "Ready" -Completed
|
||||
Write-Progress -Activity "Copy disc image files" -Status "Ready" -Completed
|
||||
} catch {
|
||||
Write-Warning "Unable to Copy all the files due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
Write-Host "Unable to Copy all the files due to an unhandled exception" -ForegroundColor Yellow
|
||||
Write-Host "Error information: $($_.Exception.Message)`n" -ForegroundColor Yellow
|
||||
Write-Host "Additional information:" -ForegroundColor Yellow
|
||||
Write-Host $PSItem.Exception.StackTrace
|
||||
# Write possible suggestions
|
||||
Write-Host "`nIf you are using an antivirus, try configuring exclusions"
|
||||
}
|
||||
}
|
||||
|
49
functions/private/Find-AppsByNameOrDescription.ps1
Normal file
49
functions/private/Find-AppsByNameOrDescription.ps1
Normal file
@ -0,0 +1,49 @@
|
||||
function Find-AppsByNameOrDescription {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Searches through the Apps on the Install Tab and hides all entries that do not match the string
|
||||
|
||||
.PARAMETER SearchString
|
||||
The string to be searched for
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory=$false)]
|
||||
[string]$SearchString = ""
|
||||
)
|
||||
# Reset the visibility if the search string is empty or the search is cleared
|
||||
if ([string]::IsNullOrWhiteSpace($SearchString)) {
|
||||
$sync.ItemsControl.Items | ForEach-Object {
|
||||
$_.Visibility = [Windows.Visibility]::Visible
|
||||
$_.Children | ForEach-Object {
|
||||
if ($null -ne $_) {
|
||||
$_.Visibility = [Windows.Visibility]::Visible
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
$sync.ItemsControl.Items | ForEach-Object {
|
||||
# Ensure ToggleButtons remain visible
|
||||
if ($_.Tag -like "CategoryToggleButton") {
|
||||
$_.Visibility = [Windows.Visibility]::Visible
|
||||
return
|
||||
}
|
||||
# Hide all CategoryWrapPanel and ToggleButton
|
||||
$_.Visibility = [Windows.Visibility]::Collapsed
|
||||
if ($_.Tag -like "CategoryWrapPanel_*") {
|
||||
# Search for Apps that match the search string
|
||||
$_.Children | Foreach-Object {
|
||||
$appEntry = $sync.configs.applicationsHashtable.$($_.Tag)
|
||||
if ($appEntry.Content -like "*$SearchString*" -or $appEntry.Description -like "*$SearchString*") {
|
||||
# Show the App and the parent CategoryWrapPanel if the string is found
|
||||
$_.Visibility = [Windows.Visibility]::Visible
|
||||
$_.parent.Visibility = [Windows.Visibility]::Visible
|
||||
}
|
||||
else {
|
||||
$_.Visibility = [Windows.Visibility]::Collapsed
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
100
functions/private/Find-TweaksByNameOrDescription.ps1
Normal file
100
functions/private/Find-TweaksByNameOrDescription.ps1
Normal file
@ -0,0 +1,100 @@
|
||||
function Find-TweaksByNameOrDescription {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Searches through the Tweaks on the Tweaks Tab and hides all entries that do not match the search string
|
||||
|
||||
.PARAMETER SearchString
|
||||
The string to be searched for
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory=$false)]
|
||||
[string]$SearchString = ""
|
||||
)
|
||||
|
||||
# Reset the visibility if the search string is empty or the search is cleared
|
||||
if ([string]::IsNullOrWhiteSpace($SearchString)) {
|
||||
# Show all categories
|
||||
$tweakspanel = $sync.Form.FindName("tweakspanel")
|
||||
$tweakspanel.Children | ForEach-Object {
|
||||
$_.Visibility = [Windows.Visibility]::Visible
|
||||
|
||||
# Foreach category section, show all items
|
||||
if ($_ -is [Windows.Controls.Border]) {
|
||||
$_.Visibility = [Windows.Visibility]::Visible
|
||||
|
||||
# Find ItemsControl
|
||||
$dockPanel = $_.Child
|
||||
if ($dockPanel -is [Windows.Controls.DockPanel]) {
|
||||
$itemsControl = $dockPanel.Children | Where-Object { $_ -is [Windows.Controls.ItemsControl] }
|
||||
if ($itemsControl) {
|
||||
# Show items in the category
|
||||
foreach ($item in $itemsControl.Items) {
|
||||
if ($item -is [Windows.Controls.Label]) {
|
||||
$item.Visibility = [Windows.Visibility]::Visible
|
||||
} elseif ($item -is [Windows.Controls.DockPanel] -or
|
||||
$item -is [Windows.Controls.StackPanel]) {
|
||||
$item.Visibility = [Windows.Visibility]::Visible
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
# Search for matching tweaks when search string is not null
|
||||
$tweakspanel = $sync.Form.FindName("tweakspanel")
|
||||
|
||||
$tweakspanel.Children | ForEach-Object {
|
||||
$categoryBorder = $_
|
||||
$categoryVisible = $false
|
||||
|
||||
if ($_ -is [Windows.Controls.Border]) {
|
||||
# Find the ItemsControl
|
||||
$dockPanel = $_.Child
|
||||
if ($dockPanel -is [Windows.Controls.DockPanel]) {
|
||||
$itemsControl = $dockPanel.Children | Where-Object { $_ -is [Windows.Controls.ItemsControl] }
|
||||
if ($itemsControl) {
|
||||
$categoryLabel = $null
|
||||
|
||||
# Process all items in the ItemsControl
|
||||
for ($i = 0; $i -lt $itemsControl.Items.Count; $i++) {
|
||||
$item = $itemsControl.Items[$i]
|
||||
|
||||
if ($item -is [Windows.Controls.Label]) {
|
||||
$categoryLabel = $item
|
||||
$item.Visibility = [Windows.Visibility]::Collapsed
|
||||
} elseif ($item -is [Windows.Controls.DockPanel]) {
|
||||
$checkbox = $item.Children | Where-Object { $_ -is [Windows.Controls.CheckBox] } | Select-Object -First 1
|
||||
$label = $item.Children | Where-Object { $_ -is [Windows.Controls.Label] } | Select-Object -First 1
|
||||
|
||||
if ($label -and ($label.Content -like "*$SearchString*" -or $label.ToolTip -like "*$SearchString*")) {
|
||||
$item.Visibility = [Windows.Visibility]::Visible
|
||||
if ($categoryLabel) { $categoryLabel.Visibility = [Windows.Visibility]::Visible }
|
||||
$categoryVisible = $true
|
||||
} else {
|
||||
$item.Visibility = [Windows.Visibility]::Collapsed
|
||||
}
|
||||
} elseif ($item -is [Windows.Controls.StackPanel]) {
|
||||
# StackPanel which contain checkboxes or other elements
|
||||
$checkbox = $item.Children | Where-Object { $_ -is [Windows.Controls.CheckBox] } | Select-Object -First 1
|
||||
|
||||
if ($checkbox -and ($checkbox.Content -like "*$SearchString*" -or $checkbox.ToolTip -like "*$SearchString*")) {
|
||||
$item.Visibility = [Windows.Visibility]::Visible
|
||||
if ($categoryLabel) { $categoryLabel.Visibility = [Windows.Visibility]::Visible }
|
||||
$categoryVisible = $true
|
||||
} else {
|
||||
$item.Visibility = [Windows.Visibility]::Collapsed
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Set the visibility based on if any item matched
|
||||
$categoryBorder.Visibility = if ($categoryVisible) { [Windows.Visibility]::Visible } else { [Windows.Visibility]::Collapsed }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
59
functions/private/Get-WinUtilSelectedPackages.ps1
Normal file
59
functions/private/Get-WinUtilSelectedPackages.ps1
Normal file
@ -0,0 +1,59 @@
|
||||
function Get-WinUtilSelectedPackages
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sorts given packages based on installer preference and availability.
|
||||
|
||||
.OUTPUTS
|
||||
Hashtable. Key = Package Manager, Value = ArrayList of packages to install
|
||||
#>
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
$PackageList,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[PackageManagers]$Preference
|
||||
)
|
||||
|
||||
if ($PackageList.count -eq 1) {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
} else {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
|
||||
}
|
||||
|
||||
$packages = [System.Collections.Hashtable]::new()
|
||||
$packagesWinget = [System.Collections.ArrayList]::new()
|
||||
$packagesChoco = [System.Collections.ArrayList]::new()
|
||||
$packages[[PackageManagers]::Winget] = $packagesWinget
|
||||
$packages[[PackageManagers]::Choco] = $packagesChoco
|
||||
|
||||
Write-Debug "Checking packages using Preference '$($Preference)'"
|
||||
|
||||
foreach ($package in $PackageList) {
|
||||
switch ($Preference) {
|
||||
"Choco" {
|
||||
if ($package.choco -eq "na") {
|
||||
Write-Debug "$($package.content) has no Choco value."
|
||||
$packagesWinget.add($package.winget)
|
||||
Write-Host "Queueing $($package.winget) for Winget"
|
||||
} else {
|
||||
$null = $packagesChoco.add($package.choco)
|
||||
Write-Host "Queueing $($package.choco) for Chocolatey"
|
||||
}
|
||||
break
|
||||
}
|
||||
"Winget" {
|
||||
if ($package.winget -eq "na") {
|
||||
Write-Debug "$($package.content) has no Winget value."
|
||||
$packagesChoco.add($package.choco)
|
||||
Write-Host "Queueing $($package.choco) for Chocolatey"
|
||||
} else {
|
||||
$null = $packagesWinget.add($($package.winget))
|
||||
Write-Host "Queueing $($package.winget) for Winget"
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $packages
|
||||
}
|
@ -13,139 +13,66 @@ Function Get-WinUtilToggleStatus {
|
||||
#>
|
||||
|
||||
Param($ToggleSwitch)
|
||||
if($ToggleSwitch -eq "WPFToggleDarkMode") {
|
||||
$app = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').AppsUseLightTheme
|
||||
$system = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').SystemUsesLightTheme
|
||||
if($app -eq 0 -and $system -eq 0) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleBingSearch") {
|
||||
$bingsearch = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search').BingSearchEnabled
|
||||
if($bingsearch -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleNumLock") {
|
||||
$numlockvalue = (Get-ItemProperty -path 'HKCU:\Control Panel\Keyboard').InitialKeyboardIndicators
|
||||
if($numlockvalue -eq 2) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleVerboseLogon") {
|
||||
$VerboseStatusvalue = (Get-ItemProperty -path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System').VerboseStatus
|
||||
if($VerboseStatusvalue -eq 1) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleShowExt") {
|
||||
$hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt
|
||||
if($hideextvalue -eq 0) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleSnapWindow") {
|
||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
|
||||
if($hidesnap -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleSnapFlyout") {
|
||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout
|
||||
if($hidesnap -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleSnapSuggestion") {
|
||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
|
||||
if($hidesnap -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleMouseAcceleration") {
|
||||
$MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed
|
||||
$MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1
|
||||
$MouseThreshold2 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold2
|
||||
|
||||
if($MouseSpeed -eq 1 -and $MouseThreshold1 -eq 6 -and $MouseThreshold2 -eq 10) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleTaskbarSearch") {
|
||||
$SearchButton = (Get-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search").SearchboxTaskbarMode
|
||||
if($SearchButton -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if ($ToggleSwitch -eq "WPFToggleStickyKeys") {
|
||||
$StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags
|
||||
if($StickyKeys -eq 58) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if ($ToggleSwitch -eq "WPFToggleTaskView") {
|
||||
$TaskView = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').ShowTaskViewButton
|
||||
if($TaskView -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
$ToggleSwitchReg = $sync.configs.tweaks.$ToggleSwitch.registry
|
||||
|
||||
try {
|
||||
if (($ToggleSwitchReg.path -imatch "hku") -and !(Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
|
||||
$null = (New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS)
|
||||
if (Get-PSDrive -Name HKU -ErrorAction SilentlyContinue) {
|
||||
Write-Debug "HKU drive created successfully"
|
||||
} else {
|
||||
Write-Debug "Failed to create HKU drive"
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Error "An error occurred regarding the HKU Drive: $_"
|
||||
return $false
|
||||
}
|
||||
|
||||
if ($ToggleSwitch -eq "WPFToggleHiddenFiles") {
|
||||
$HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden
|
||||
if($HiddenFiles -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if ($ToggleSwitchReg) {
|
||||
$count = 0
|
||||
|
||||
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
|
||||
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
|
||||
if($TaskbarWidgets -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
foreach ($regentry in $ToggleSwitchReg) {
|
||||
try {
|
||||
if (!(Test-Path $regentry.Path)) {
|
||||
New-Item -Path $regentry.Path -Force | Out-Null
|
||||
}
|
||||
$regstate = (Get-ItemProperty -path $regentry.Path).$($regentry.Name)
|
||||
if ($regstate -eq $regentry.Value) {
|
||||
$count += 1
|
||||
Write-Debug "$($regentry.Name) is true (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))"
|
||||
} else {
|
||||
Write-Debug "$($regentry.Name) is false (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))"
|
||||
}
|
||||
if (!$regstate) {
|
||||
switch ($regentry.DefaultState) {
|
||||
"true" {
|
||||
$regstate = $regentry.Value
|
||||
$count += 1
|
||||
}
|
||||
"false" {
|
||||
$regstate = $regentry.OriginalValue
|
||||
}
|
||||
default {
|
||||
Write-Error "Entry for $($regentry.Name) does not exist and no DefaultState is defined."
|
||||
$regstate = $regentry.OriginalValue
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Error "An unexpected error occurred: $_"
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($ToggleSwitch -eq "WPFToggleTaskbarAlignment") {
|
||||
$TaskbarAlignment = (Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskbarAl
|
||||
if($TaskbarAlignment -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
|
||||
if ($count -eq $ToggleSwitchReg.Count) {
|
||||
Write-Debug "$($ToggleSwitchReg.Name) is true (count: $count)"
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if ($ToggleSwitch -eq "WPFToggleDetailedBSoD") {
|
||||
$DetailedBSoD1 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisplayParameters
|
||||
$DetailedBSoD2 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisableEmoticon
|
||||
if (($DetailedBSoD1 -eq 0) -or ($DetailedBSoD2 -eq 0) -or !$DetailedBSoD1 -or !$DetailedBSoD2) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
Write-Debug "$($ToggleSwitchReg.Name) is false (count: $count)"
|
||||
return $false
|
||||
}
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
function Get-WinUtilWingetLatest {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Uses GitHub API to check for the latest release of Winget.
|
||||
.DESCRIPTION
|
||||
This function grabs the latest version of Winget and returns the download path to Install-WinUtilWinget for installation.
|
||||
#>
|
||||
# Invoke-WebRequest is notoriously slow when the byte progress is displayed. The following lines disable the progress bar and reset them at the end of the function
|
||||
$PreviousProgressPreference = $ProgressPreference
|
||||
$ProgressPreference = "silentlyContinue"
|
||||
try {
|
||||
# Grabs the latest release of Winget from the Github API for the install process.
|
||||
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/Winget-cli/releases/latest" -Method Get -ErrorAction Stop
|
||||
$latestVersion = $response.tag_name #Stores version number of latest release.
|
||||
$licenseWingetUrl = $response.assets.browser_download_url | Where-Object {$_ -like "*License1.xml"} #Index value for License file.
|
||||
Write-Host "Latest Version:`t$($latestVersion)`n"
|
||||
Write-Host "Downloading..."
|
||||
$assetUrl = $response.assets.browser_download_url | Where-Object {$_ -like "*Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"}
|
||||
Invoke-WebRequest -Uri $licenseWingetUrl -OutFile $ENV:TEMP\License1.xml
|
||||
# The only pain is that the msixbundle for winget-cli is 246MB. In some situations this can take a bit, with slower connections.
|
||||
Invoke-WebRequest -Uri $assetUrl -OutFile $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle
|
||||
} catch {
|
||||
throw [WingetFailedInstall]::new('Failed to get latest Winget release and license')
|
||||
}
|
||||
$ProgressPreference = $PreviousProgressPreference
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
function Get-WinUtilWingetPrerequisites {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Downloads the Winget Prereqs.
|
||||
.DESCRIPTION
|
||||
Downloads Prereqs for Winget. Version numbers are coded as variables and can be updated as uncommonly as Microsoft updates the prereqs.
|
||||
#>
|
||||
|
||||
# I don't know of a way to detect the prereqs automatically, so if someone has a better way of defining these, that would be great.
|
||||
# Microsoft.VCLibs version rarely changes, but for future compatibility I made it a variable.
|
||||
$versionVCLibs = "14.00"
|
||||
$fileVCLibs = "https://aka.ms/Microsoft.VCLibs.x64.${versionVCLibs}.Desktop.appx"
|
||||
# Write-Host "$fileVCLibs"
|
||||
# Microsoft.UI.Xaml version changed recently, so I made the version numbers variables.
|
||||
$versionUIXamlMinor = "2.8"
|
||||
$versionUIXamlPatch = "2.8.6"
|
||||
$fileUIXaml = "https://github.com/microsoft/microsoft-ui-xaml/releases/download/v${versionUIXamlPatch}/Microsoft.UI.Xaml.${versionUIXamlMinor}.x64.appx"
|
||||
# Write-Host "$fileUIXaml"
|
||||
|
||||
try {
|
||||
Write-Host "Downloading Microsoft.VCLibs Dependency..."
|
||||
Invoke-WebRequest -Uri $fileVCLibs -OutFile $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx
|
||||
Write-Host "Downloading Microsoft.UI.Xaml Dependency...`n"
|
||||
Invoke-WebRequest -Uri $fileUIXaml -OutFile $ENV:TEMP\Microsoft.UI.Xaml.x64.appx
|
||||
} catch {
|
||||
throw [WingetFailedInstall]::new('Failed to install prerequsites')
|
||||
}
|
||||
}
|
74
functions/private/Initalize-InstallAppEntry.ps1
Normal file
74
functions/private/Initalize-InstallAppEntry.ps1
Normal file
@ -0,0 +1,74 @@
|
||||
function Initialize-InstallAppEntry {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates the app entry to be placed on the isntall tab for a given app
|
||||
Used to as part of the Install Tab UI generation
|
||||
.PARAMETER TargetElement
|
||||
The Element into which the Apps should be placed
|
||||
.PARAMETER appKey
|
||||
The Key of the app inside the $sync.configs.applicationsHashtable
|
||||
#>
|
||||
param(
|
||||
[Windows.Controls.WrapPanel]$TargetElement,
|
||||
$appKey
|
||||
)
|
||||
|
||||
# Create the outer Border for the application type
|
||||
$border = New-Object Windows.Controls.Border
|
||||
$border.Style = $sync.Form.Resources.AppEntryBorderStyle
|
||||
$border.Tag = $appKey
|
||||
$border.ToolTip = $Apps.$appKey.description
|
||||
$border.Add_MouseLeftButtonUp({
|
||||
$childCheckbox = ($this.Child | Where-Object {$_.Template.TargetType -eq [System.Windows.Controls.Checkbox]})[0]
|
||||
$childCheckBox.isChecked = -not $childCheckbox.IsChecked
|
||||
})
|
||||
$border.Add_MouseEnter({
|
||||
if (($sync.$($this.Tag).IsChecked) -eq $false) {
|
||||
$this.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallHighlightedColor")
|
||||
}
|
||||
})
|
||||
$border.Add_MouseLeave({
|
||||
if (($sync.$($this.Tag).IsChecked) -eq $false) {
|
||||
$this.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallUnselectedColor")
|
||||
}
|
||||
})
|
||||
$border.Add_MouseRightButtonUp({
|
||||
# Store the selected app in a global variable so it can be used in the popup
|
||||
$sync.appPopupSelectedApp = $this.Tag
|
||||
# Set the popup position to the current mouse position
|
||||
$sync.appPopup.PlacementTarget = $this
|
||||
$sync.appPopup.IsOpen = $true
|
||||
})
|
||||
|
||||
$checkBox = New-Object Windows.Controls.CheckBox
|
||||
$checkBox.Name = $appKey
|
||||
$checkbox.Style = $sync.Form.Resources.AppEntryCheckboxStyle
|
||||
$checkbox.Add_Checked({
|
||||
Invoke-WPFSelectedAppsUpdate -type "Add" -checkbox $this
|
||||
$borderElement = $this.Parent
|
||||
$borderElement.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallSelectedColor")
|
||||
})
|
||||
|
||||
$checkbox.Add_Unchecked({
|
||||
Invoke-WPFSelectedAppsUpdate -type "Remove" -checkbox $this
|
||||
$borderElement = $this.Parent
|
||||
$borderElement.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallUnselectedColor")
|
||||
})
|
||||
|
||||
# Create the TextBlock for the application name
|
||||
$appName = New-Object Windows.Controls.TextBlock
|
||||
$appName.Style = $sync.Form.Resources.AppEntryNameStyle
|
||||
$appName.Text = $Apps.$appKey.content
|
||||
|
||||
# Add the name to the Checkbox
|
||||
$checkBox.Content = $appName
|
||||
|
||||
# Add accessibility properties to make the elements screen reader friendly
|
||||
$checkBox.SetValue([Windows.Automation.AutomationProperties]::NameProperty, $Apps.$appKey.content)
|
||||
$border.SetValue([Windows.Automation.AutomationProperties]::NameProperty, $Apps.$appKey.content)
|
||||
|
||||
$border.Child = $checkBox
|
||||
# Add the border to the corresponding Category
|
||||
$TargetElement.Children.Add($border) | Out-Null
|
||||
return $checkbox
|
||||
}
|
45
functions/private/Initialize-InstallAppArea.ps1
Normal file
45
functions/private/Initialize-InstallAppArea.ps1
Normal file
@ -0,0 +1,45 @@
|
||||
function Initialize-InstallAppArea {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a [Windows.Controls.ScrollViewer] containing a [Windows.Controls.ItemsControl] which is setup to use Virtualization to only load the visible elements for performance reasons.
|
||||
This is used as the parent object for all category and app entries on the install tab
|
||||
Used to as part of the Install Tab UI generation
|
||||
|
||||
.PARAMETER TargetElement
|
||||
The element to which the AppArea shoud be added
|
||||
|
||||
#>
|
||||
param($TargetElement)
|
||||
$targetGrid = $sync.Form.FindName($TargetElement)
|
||||
$null = $targetGrid.Children.Clear()
|
||||
|
||||
# Create the outer Border for the aren where the apps will be placed
|
||||
$Border = New-Object Windows.Controls.Border
|
||||
$Border.VerticalAlignment = "Stretch"
|
||||
$Border.SetResourceReference([Windows.Controls.Control]::StyleProperty, "BorderStyle")
|
||||
|
||||
# Add a ScrollViewer, because the ItemsControl does not support scrolling by itself
|
||||
$scrollViewer = New-Object Windows.Controls.ScrollViewer
|
||||
$scrollViewer.VerticalScrollBarVisibility = 'Auto'
|
||||
$scrollViewer.HorizontalAlignment = 'Stretch'
|
||||
$scrollViewer.VerticalAlignment = 'Stretch'
|
||||
$scrollViewer.CanContentScroll = $true
|
||||
|
||||
## Create the ItemsControl, which will be the parent of all the app entries
|
||||
$itemsControl = New-Object Windows.Controls.ItemsControl
|
||||
$itemsControl.HorizontalAlignment = 'Stretch'
|
||||
$itemsControl.VerticalAlignment = 'Stretch'
|
||||
|
||||
# Enable virtualization for the ItemsControl to improve performance (It's hard to test if this is actually working, so if you know what you're doing, please check this)
|
||||
$itemsPanelTemplate = New-Object Windows.Controls.ItemsPanelTemplate
|
||||
$factory = New-Object Windows.FrameworkElementFactory ([Windows.Controls.VirtualizingStackPanel])
|
||||
$itemsPanelTemplate.VisualTree = $factory
|
||||
$itemsControl.ItemsPanel = $itemsPanelTemplate
|
||||
$itemsControl.SetValue([Windows.Controls.VirtualizingStackPanel]::IsVirtualizingProperty, $true)
|
||||
$itemsControl.SetValue([Windows.Controls.VirtualizingStackPanel]::VirtualizationModeProperty, [Windows.Controls.VirtualizationMode]::Recycling)
|
||||
|
||||
$scrollViewer.Content = $itemsControl
|
||||
$Border.Child = $scrollViewer
|
||||
$null = $targetGrid.Children.Add($Border)
|
||||
return $itemsControl
|
||||
}
|
56
functions/private/Initialize-InstallCategoryAppList.ps1
Normal file
56
functions/private/Initialize-InstallCategoryAppList.ps1
Normal file
@ -0,0 +1,56 @@
|
||||
function Initialize-InstallCategoryAppList {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Clears the Target Element and sets up a "Loading" message. This is done, because loading of all apps can take a bit of time in some scenarios
|
||||
Iterates through all Categories and Apps and adds them to the UI
|
||||
Used to as part of the Install Tab UI generation
|
||||
.PARAMETER TargetElement
|
||||
The Element into which the Categories and Apps should be placed
|
||||
.PARAMETER Apps
|
||||
The Hashtable of Apps to be added to the UI
|
||||
The Categories are also extracted from the Apps Hashtable
|
||||
|
||||
#>
|
||||
param(
|
||||
$TargetElement,
|
||||
$Apps
|
||||
)
|
||||
function Add-Category {
|
||||
param(
|
||||
[string]$Category,
|
||||
[Windows.Controls.ItemsControl]$TargetElement
|
||||
)
|
||||
|
||||
$toggleButton = New-Object Windows.Controls.Label
|
||||
$toggleButton.Content = "$Category"
|
||||
$toggleButton.Tag = "CategoryToggleButton"
|
||||
$sync.$Category = $Category
|
||||
|
||||
$null = $TargetElement.Items.Add($toggleButton)
|
||||
}
|
||||
|
||||
|
||||
# Pre-group apps by category
|
||||
$appsByCategory = @{}
|
||||
foreach ($appKey in $Apps.Keys) {
|
||||
$category = $Apps.$appKey.Category
|
||||
if (-not $appsByCategory.ContainsKey($category)) {
|
||||
$appsByCategory[$category] = @()
|
||||
}
|
||||
$appsByCategory[$category] += $appKey
|
||||
}
|
||||
foreach ($category in $($appsByCategory.Keys | Sort-Object)) {
|
||||
Add-Category -Category $category -TargetElement $TargetElement
|
||||
$wrapPanel = New-Object Windows.Controls.WrapPanel
|
||||
$wrapPanel.Orientation = "Horizontal"
|
||||
$wrapPanel.HorizontalAlignment = "Stretch"
|
||||
$wrapPanel.VerticalAlignment = "Center"
|
||||
$wrapPanel.Margin = New-Object Windows.Thickness(0, 0, 0, 20)
|
||||
$wrapPanel.Visibility = [Windows.Visibility]::Visible
|
||||
$wrapPanel.Tag = "CategoryWrapPanel_$category"
|
||||
$null = $TargetElement.Items.Add($wrapPanel)
|
||||
$appsByCategory[$category] |Sort-Object | ForEach-Object {
|
||||
$sync.$_ = $(Initialize-InstallAppEntry -TargetElement $wrapPanel -AppKey $_)
|
||||
}
|
||||
}
|
||||
}
|
@ -13,10 +13,11 @@ function Install-WinUtilChoco {
|
||||
if((Test-WinUtilPackageManager -choco) -eq "installed") {
|
||||
return
|
||||
}
|
||||
|
||||
# Install logic taken from https://chocolatey.org/install#individual
|
||||
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
|
||||
Start-Process -FilePath "powershell" -ArgumentList "choco feature enable -n allowGlobalConfirmation" -Wait -NoNewWindow
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force;
|
||||
[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 {
|
||||
Write-Host "===========================================" -Foregroundcolor Red
|
||||
|
@ -44,7 +44,7 @@ function Install-WinUtilProgramChoco {
|
||||
New-Item -ItemType File -Path $filePath | Out-Null
|
||||
}
|
||||
|
||||
function Run-ChocoCommand {
|
||||
function Invoke-ChocoCommand {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Executes a Chocolatey command with the specified arguments and returns the exit code.
|
||||
@ -60,14 +60,14 @@ function Install-WinUtilProgramChoco {
|
||||
The exit code of the Chocolatey command.
|
||||
|
||||
.EXAMPLE
|
||||
$exitCode = Run-ChocoCommand -arguments "install 7zip -y"
|
||||
$exitCode = Invoke-ChocoCommand -arguments "install 7zip -y"
|
||||
#>
|
||||
|
||||
param ($arguments)
|
||||
return (Start-Process -FilePath "choco" -ArgumentList $arguments -Wait -PassThru).ExitCode
|
||||
}
|
||||
|
||||
function Check-UpgradeNeeded {
|
||||
function Test-UpgradeNeeded {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks if an upgrade is needed for a Chocolatey package based on the content of a log file.
|
||||
@ -83,7 +83,7 @@ function Install-WinUtilProgramChoco {
|
||||
True if the log file indicates that an upgrade is needed; otherwise, false.
|
||||
|
||||
.EXAMPLE
|
||||
$isUpgradeNeeded = Check-UpgradeNeeded -filePath "C:\temp\install-output.txt"
|
||||
$isUpgradeNeeded = Test-UpgradeNeeded -filePath "C:\temp\install-output.txt"
|
||||
#>
|
||||
|
||||
param ($filePath)
|
||||
@ -149,11 +149,11 @@ function Install-WinUtilProgramChoco {
|
||||
Write-Host "Starting installation of $Program with Chocolatey."
|
||||
|
||||
try {
|
||||
$installStatusCode = Run-ChocoCommand "install $Program -y --log-file $installOutputFile"
|
||||
$installStatusCode = Invoke-ChocoCommand "install $Program -y --log-file $installOutputFile"
|
||||
if ($installStatusCode -eq 0) {
|
||||
|
||||
if (Check-UpgradeNeeded $installOutputFile) {
|
||||
$upgradeStatusCode = Run-ChocoCommand "upgrade $Program -y"
|
||||
if (Test-UpgradeNeeded $installOutputFile) {
|
||||
$upgradeStatusCode = Invoke-ChocoCommand "upgrade $Program -y"
|
||||
Write-Host "$Program was" $(if ($upgradeStatusCode -eq 0) { "upgraded successfully." } else { "not upgraded." })
|
||||
}
|
||||
else {
|
||||
@ -207,7 +207,7 @@ function Install-WinUtilProgramChoco {
|
||||
if ($chocoPackages) {
|
||||
Write-Host "Starting uninstallation of $chocoPackages with Chocolatey."
|
||||
try {
|
||||
$uninstallStatusCode = Run-ChocoCommand "uninstall $chocoPackages -y"
|
||||
$uninstallStatusCode = Invoke-ChocoCommand "uninstall $chocoPackages -y"
|
||||
Write-Host "$Program" $(if ($uninstallStatusCode -eq 0) { "uninstalled successfully." } else { "failed to uninstall." })
|
||||
}
|
||||
catch {
|
||||
|
@ -33,36 +33,44 @@ function Install-WinUtilWinget {
|
||||
return
|
||||
}
|
||||
|
||||
# Install Winget via GitHub method.
|
||||
# Used part of my own script with some modification: ruxunderscore/windows-initialization
|
||||
Write-Host "Downloading Winget Prerequsites`n"
|
||||
Get-WinUtilWingetPrerequisites
|
||||
Write-Host "Downloading Winget and License File`r"
|
||||
Get-WinUtilWingetLatest
|
||||
Write-Host "Installing Winget w/ Prerequsites`r"
|
||||
Add-AppxProvisionedPackage -Online -PackagePath $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle -DependencyPackagePath $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx, $ENV:TEMP\Microsoft.UI.Xaml.x64.appx -LicensePath $ENV:TEMP\License1.xml
|
||||
Write-Host "Manually adding Winget Sources, from Winget CDN."
|
||||
Add-AppxPackage -Path https://cdn.winget.microsoft.com/cache/source.msix #Seems some installs of Winget don't add the repo source, this should makes sure that it's installed every time.
|
||||
Write-Host "Winget Installed" -ForegroundColor Green
|
||||
Write-Host "Enabling NuGet and Module..."
|
||||
Install-PackageProvider -Name NuGet -Force
|
||||
Install-Module -Name Microsoft.WinGet.Client -Force
|
||||
# Winget only needs a refresh of the environment variables to be used.
|
||||
Write-Output "Refreshing Environment Variables...`n"
|
||||
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
||||
} catch {
|
||||
Write-Host "Failure detected while installing via GitHub method. Continuing with Chocolatey method as fallback." -ForegroundColor Red
|
||||
# In case install fails via GitHub method.
|
||||
Write-Host "Attempting to install/update Winget`r"
|
||||
try {
|
||||
# Install Choco if not already present
|
||||
Install-WinUtilChoco
|
||||
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget-cli"
|
||||
Write-Host "Winget Installed" -ForegroundColor Green
|
||||
Write-Output "Refreshing Environment Variables...`n"
|
||||
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
||||
$wingetCmd = Get-Command winget -ErrorAction Stop
|
||||
Write-Information "Attempting to update WinGet using WinGet..."
|
||||
$result = Start-Process -FilePath "`"$($wingetCmd.Source)`"" -ArgumentList "install -e --accept-source-agreements --accept-package-agreements Microsoft.AppInstaller" -Wait -NoNewWindow -PassThru
|
||||
if ($result.ExitCode -ne 0) {
|
||||
throw "WinGet update failed with exit code: $($result.ExitCode)"
|
||||
}
|
||||
Write-Output "Refreshing Environment Variables...`n"
|
||||
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
||||
return
|
||||
} catch {
|
||||
throw [WingetFailedInstall]::new('Failed to install!')
|
||||
Write-Information "WinGet not found or update failed. Attempting to install from Microsoft Store..."
|
||||
}
|
||||
}
|
||||
try {
|
||||
Write-Host "Attempting to repair WinGet using Repair-WinGetPackageManager..." -ForegroundColor Yellow
|
||||
|
||||
# Check if Windows version supports Repair-WinGetPackageManager (24H2 and above)
|
||||
if ([System.Environment]::OSVersion.Version.Build -ge 26100) {
|
||||
Repair-WinGetPackageManager -Force -Latest -Verbose
|
||||
# Verify if repair was successful
|
||||
$wingetCmd = Get-Command winget -ErrorAction Stop
|
||||
Write-Host "WinGet repair successful!" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Repair-WinGetPackageManager is only available on Windows 24H2 and above. Your version doesn't support this method." -ForegroundColor Yellow
|
||||
throw "Windows version not supported for repair method"
|
||||
}
|
||||
|
||||
Write-Output "Refreshing Environment Variables...`n"
|
||||
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
||||
return
|
||||
|
||||
} catch {
|
||||
Write-Error "All installation methods failed. Unable to install WinGet."
|
||||
throw
|
||||
}
|
||||
} catch {
|
||||
Write-Error "An error occurred during WinGet installation: $_"
|
||||
throw
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
function Invoke-WinUtilBingSearch {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Disables/Enables Bing Search
|
||||
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Bing Search
|
||||
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Enabling Bing Search"
|
||||
$value = 1
|
||||
} else {
|
||||
Write-Host "Disabling Bing Search"
|
||||
$value = 0
|
||||
}
|
||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search"
|
||||
Set-ItemProperty -Path $Path -Name BingSearchEnabled -Value $value
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -43,7 +43,7 @@ Function Invoke-WinUtilCurrentSystem {
|
||||
|
||||
if($CheckBox -eq "tweaks") {
|
||||
|
||||
if(!(Test-Path 'HKU:\')) {New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS}
|
||||
if(!(Test-Path 'HKU:\')) {$null = (New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS)}
|
||||
$ScheduledTasks = Get-ScheduledTask
|
||||
|
||||
$sync.configs.tweaks | Get-Member -MemberType NoteProperty | ForEach-Object {
|
||||
|
@ -1,32 +0,0 @@
|
||||
Function Invoke-WinUtilDarkMode {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Enables/Disables Dark Mode
|
||||
|
||||
.PARAMETER DarkMoveEnabled
|
||||
Indicates the current dark mode state
|
||||
|
||||
#>
|
||||
Param($DarkMoveEnabled)
|
||||
try {
|
||||
if ($DarkMoveEnabled -eq $false) {
|
||||
Write-Host "Enabling Dark Mode"
|
||||
$DarkMoveValue = 0
|
||||
} else {
|
||||
Write-Host "Disabling Dark Mode"
|
||||
$DarkMoveValue = 1
|
||||
}
|
||||
|
||||
$Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
||||
Set-ItemProperty -Path $Path -Name AppsUseLightTheme -Value $DarkMoveValue
|
||||
Set-ItemProperty -Path $Path -Name SystemUsesLightTheme -Value $DarkMoveValue
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
Function Invoke-WinUtilDetailedBSoD {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Enables/Disables Detailed BSoD
|
||||
(Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl' -Name 'DisplayParameters').DisplayParameters
|
||||
|
||||
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Enabling Detailed BSoD"
|
||||
$value = 1
|
||||
} else {
|
||||
Write-Host "Disabling Detailed BSoD"
|
||||
$value =0
|
||||
}
|
||||
|
||||
$Path = "HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl"
|
||||
$dwords = ("DisplayParameters", "DisableEmoticon")
|
||||
foreach ($name in $dwords) {
|
||||
Set-ItemProperty -Path $Path -Name $name -Value $value
|
||||
}
|
||||
Set-ItemProperty -Path $Path -Name DisplayParameters -Value $value
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
43
functions/private/Invoke-WinUtilExplorerUpdate.ps1
Normal file
43
functions/private/Invoke-WinUtilExplorerUpdate.ps1
Normal file
@ -0,0 +1,43 @@
|
||||
function Invoke-WinUtilExplorerUpdate {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Refreshes the Windows Explorer
|
||||
#>
|
||||
|
||||
param (
|
||||
[string]$action = "refresh"
|
||||
)
|
||||
|
||||
if ($action -eq "refresh") {
|
||||
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))
|
||||
}
|
||||
} elseif ($action -eq "restart") {
|
||||
# Restart the Windows Explorer
|
||||
taskkill.exe /F /IM "explorer.exe"
|
||||
Start-Process "explorer.exe"
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
function Invoke-WinUtilHiddenFiles {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Enable/Disable Hidden Files
|
||||
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Hidden Files
|
||||
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Enabling Hidden Files"
|
||||
$value = 1
|
||||
} else {
|
||||
Write-Host "Disabling Hidden Files"
|
||||
$value = 0
|
||||
}
|
||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||
Set-ItemProperty -Path $Path -Name Hidden -Value $value
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
103
functions/private/Invoke-WinUtilInstallPSProfile.ps1
Normal file
103
functions/private/Invoke-WinUtilInstallPSProfile.ps1
Normal file
@ -0,0 +1,103 @@
|
||||
function Invoke-WinUtilInstallPSProfile {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Backs up your original profile then installs and applies the CTT PowerShell profile.
|
||||
#>
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PROFILE -DebugPreference $DebugPreference -ScriptBlock {
|
||||
# Remap the automatic built-in $PROFILE variable to the parameter named $PSProfile.
|
||||
param ($PSProfile)
|
||||
|
||||
function Invoke-PSSetup {
|
||||
# Define the URL used to download Chris Titus Tech's PowerShell profile.
|
||||
$url = "https://raw.githubusercontent.com/ChrisTitusTech/powershell-profile/main/Microsoft.PowerShell_profile.ps1"
|
||||
|
||||
# Get the file hash for the user's current PowerShell profile.
|
||||
$OldHash = Get-FileHash $PSProfile -ErrorAction SilentlyContinue
|
||||
|
||||
# Download Chris Titus Tech's PowerShell profile to the 'TEMP' folder.
|
||||
Invoke-RestMethod $url -OutFile "$env:TEMP/Microsoft.PowerShell_profile.ps1"
|
||||
|
||||
# Get the file hash for Chris Titus Tech's PowerShell profile.
|
||||
$NewHash = Get-FileHash "$env:TEMP/Microsoft.PowerShell_profile.ps1"
|
||||
|
||||
# Store the file hash of Chris Titus Tech's PowerShell profile.
|
||||
if (!(Test-Path "$PSProfile.hash")) {
|
||||
$NewHash.Hash | Out-File "$PSProfile.hash"
|
||||
}
|
||||
|
||||
# Check if the new profile's hash doesn't match the old profile's hash.
|
||||
if ($NewHash.Hash -ne $OldHash.Hash) {
|
||||
# Check if oldprofile.ps1 exists and use it as a profile backup source.
|
||||
if (Test-Path "$env:USERPROFILE\oldprofile.ps1") {
|
||||
Write-Host "===> Backup File Exists... <===" -ForegroundColor Yellow
|
||||
Write-Host "===> Moving Backup File... <===" -ForegroundColor Yellow
|
||||
Copy-Item "$env:USERPROFILE\oldprofile.ps1" "$PSProfile.bak"
|
||||
Write-Host "===> Profile Backup: Done. <===" -ForegroundColor Yellow
|
||||
} else {
|
||||
# If oldprofile.ps1 does not exist use $PSProfile as a profile backup source.
|
||||
# Check if the profile backup file has not already been created on the disk.
|
||||
if ((Test-Path $PSProfile) -and (-not (Test-Path "$PSProfile.bak"))) {
|
||||
# Let the user know their PowerShell profile is being backed up.
|
||||
Write-Host "===> Backing Up Profile... <===" -ForegroundColor Yellow
|
||||
|
||||
# Copy the user's current PowerShell profile to the backup file path.
|
||||
Copy-Item -Path $PSProfile -Destination "$PSProfile.bak"
|
||||
|
||||
# Let the user know the profile backup has been completed successfully.
|
||||
Write-Host "===> Profile Backup: Done. <===" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# Let the user know Chris Titus Tech's PowerShell profile is being installed.
|
||||
Write-Host "===> Installing Profile... <===" -ForegroundColor Yellow
|
||||
|
||||
# Start a new hidden PowerShell instance because setup.ps1 does not work in runspaces.
|
||||
Start-Process -FilePath "pwsh" -ArgumentList "-ExecutionPolicy Bypass -NoProfile -Command `"Invoke-Expression (Invoke-WebRequest `'https://github.com/ChrisTitusTech/powershell-profile/raw/main/setup.ps1`')`"" -WindowStyle Hidden -Wait
|
||||
|
||||
# Let the user know Chris Titus Tech's PowerShell profile has been installed successfully.
|
||||
Write-Host "Profile has been installed. Please restart your shell to reflect the changes!" -ForegroundColor Magenta
|
||||
|
||||
# Let the user know Chris Titus Tech's PowerShell profile has been setup successfully.
|
||||
Write-Host "===> Finished Profile Setup <===" -ForegroundColor Yellow
|
||||
} else {
|
||||
# Let the user know Chris Titus Tech's PowerShell profile is already fully up-to-date.
|
||||
Write-Host "Profile is up to date" -ForegroundColor Magenta
|
||||
}
|
||||
}
|
||||
|
||||
# Check if PowerShell Core is currently installed as a program and is available as a command.
|
||||
if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
|
||||
# Check if the version of PowerShell Core currently in use is version 7 or higher.
|
||||
if ($PSVersionTable.PSVersion.Major -ge 7) {
|
||||
# Invoke the PowerShell Profile setup script to install Chris Titus Tech's PowerShell Profile.
|
||||
Invoke-PSSetup
|
||||
} else {
|
||||
# Let the user know that PowerShell 7 is installed but is not currently in use.
|
||||
Write-Host "This profile requires Powershell 7, which is currently installed but not used!" -ForegroundColor Red
|
||||
|
||||
# Load the necessary .NET library required to use Windows Forms to show dialog boxes.
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
|
||||
# Display the message box asking if the user wants to install PowerShell 7 or not.
|
||||
$question = [System.Windows.Forms.MessageBox]::Show(
|
||||
"Profile requires Powershell 7, which is currently installed but not used! Do you want to install the profile for Powershell 7?",
|
||||
"Question",
|
||||
[System.Windows.Forms.MessageBoxButtons]::YesNo,
|
||||
[System.Windows.Forms.MessageBoxIcon]::Question
|
||||
)
|
||||
|
||||
# Proceed with the installation and setup of the profile as the user pressed the 'Yes' button.
|
||||
if ($question -eq [System.Windows.Forms.DialogResult]::Yes) {
|
||||
Invoke-PSSetup
|
||||
} else {
|
||||
# Let the user know the setup of the profile will not proceed as they pressed the 'No' button.
|
||||
Write-Host "Not proceeding with the profile setup!" -ForegroundColor Magenta
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# Let the user know that the profile requires PowerShell Core but it is not currently installed.
|
||||
Write-Host "This profile requires Powershell Core, which is currently not installed!" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
Function Invoke-WinUtilMouseAcceleration {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Enables/Disables Mouse Acceleration
|
||||
|
||||
.PARAMETER DarkMoveEnabled
|
||||
Indicates the current Mouse Acceleration State
|
||||
|
||||
#>
|
||||
Param($MouseAccelerationEnabled)
|
||||
try {
|
||||
if ($MouseAccelerationEnabled -eq $false) {
|
||||
Write-Host "Enabling Mouse Acceleration"
|
||||
$MouseSpeed = 1
|
||||
$MouseThreshold1 = 6
|
||||
$MouseThreshold2 = 10
|
||||
} else {
|
||||
Write-Host "Disabling Mouse Acceleration"
|
||||
$MouseSpeed = 0
|
||||
$MouseThreshold1 = 0
|
||||
$MouseThreshold2 = 0
|
||||
|
||||
}
|
||||
|
||||
$Path = "HKCU:\Control Panel\Mouse"
|
||||
Set-ItemProperty -Path $Path -Name MouseSpeed -Value $MouseSpeed
|
||||
Set-ItemProperty -Path $Path -Name MouseThreshold1 -Value $MouseThreshold1
|
||||
Set-ItemProperty -Path $Path -Name MouseThreshold2 -Value $MouseThreshold2
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
function Invoke-WinUtilNumLock {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disables/Enables NumLock on startup
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Numlock on startup
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Enabling Numlock on startup"
|
||||
$value = 2
|
||||
} else {
|
||||
Write-Host "Disabling Numlock on startup"
|
||||
$value = 0
|
||||
}
|
||||
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS
|
||||
$HKUPath = "HKU:\.Default\Control Panel\Keyboard"
|
||||
$HKCUPath = "HKCU:\Control Panel\Keyboard"
|
||||
Set-ItemProperty -Path $HKUPath -Name InitialKeyboardIndicators -Value $value
|
||||
Set-ItemProperty -Path $HKCUPath -Name InitialKeyboardIndicators -Value $value
|
||||
}
|
||||
Catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
81
functions/private/Invoke-WinUtilSSHServer.ps1
Normal file
81
functions/private/Invoke-WinUtilSSHServer.ps1
Normal file
@ -0,0 +1,81 @@
|
||||
function Invoke-WinUtilSSHServer {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Enables OpenSSH server to remote into your windows device
|
||||
#>
|
||||
|
||||
# Get the latest version of OpenSSH Server
|
||||
$FeatureName = Get-WindowsCapability -Online | Where-Object { $_.Name -like "OpenSSH.Server*" }
|
||||
|
||||
# Install the OpenSSH Server feature if not already installed
|
||||
if ($FeatureName.State -ne "Installed") {
|
||||
Write-Host "Enabling OpenSSH Server"
|
||||
Add-WindowsCapability -Online -Name $FeatureName.Name
|
||||
}
|
||||
|
||||
# Sets up the OpenSSH Server service
|
||||
Write-Host "Starting the services"
|
||||
Start-Service -Name sshd
|
||||
Set-Service -Name sshd -StartupType Automatic
|
||||
|
||||
# Sets up the ssh-agent service
|
||||
Start-Service 'ssh-agent'
|
||||
Set-Service -Name 'ssh-agent' -StartupType 'Automatic'
|
||||
|
||||
# Confirm the required services are running
|
||||
$SSHDaemonService = Get-Service -Name sshd
|
||||
$SSHAgentService = Get-Service -Name 'ssh-agent'
|
||||
|
||||
if ($SSHDaemonService.Status -eq 'Running') {
|
||||
Write-Host "OpenSSH Server is running."
|
||||
} else {
|
||||
try {
|
||||
Write-Host "OpenSSH Server is not running. Attempting to restart..."
|
||||
Restart-Service -Name sshd -Force
|
||||
Write-Host "OpenSSH Server has been restarted successfully."
|
||||
} catch {
|
||||
Write-Host "Failed to restart OpenSSH Server: $_"
|
||||
}
|
||||
}
|
||||
if ($SSHAgentService.Status -eq 'Running') {
|
||||
Write-Host "ssh-agent is running."
|
||||
} else {
|
||||
try {
|
||||
Write-Host "ssh-agent is not running. Attempting to restart..."
|
||||
Restart-Service -Name sshd -Force
|
||||
Write-Host "ssh-agent has been restarted successfully."
|
||||
} catch {
|
||||
Write-Host "Failed to restart ssh-agent : $_"
|
||||
}
|
||||
}
|
||||
|
||||
#Adding Firewall rule for port 22
|
||||
Write-Host "Setting up firewall rules"
|
||||
$firewallRule = (Get-NetFirewallRule -Name 'sshd').Enabled
|
||||
if ($firewallRule) {
|
||||
Write-Host "Firewall rule for OpenSSH Server (sshd) already exists."
|
||||
} else {
|
||||
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
|
||||
Write-Host "Firewall rule for OpenSSH Server created and enabled."
|
||||
}
|
||||
|
||||
# Check for the authorized_keys file
|
||||
$sshFolderPath = "$env:HOMEDRIVE\$env:HOMEPATH\.ssh"
|
||||
$authorizedKeysPath = "$sshFolderPath\authorized_keys"
|
||||
|
||||
if (-not (Test-Path -Path $sshFolderPath)) {
|
||||
Write-Host "Creating ssh directory..."
|
||||
New-Item -Path $sshFolderPath -ItemType Directory -Force
|
||||
}
|
||||
|
||||
if (-not (Test-Path -Path $authorizedKeysPath)) {
|
||||
Write-Host "Creating authorized_keys file..."
|
||||
New-Item -Path $authorizedKeysPath -ItemType File -Force
|
||||
Write-Host "authorized_keys file created at $authorizedKeysPath."
|
||||
} else {
|
||||
Write-Host "authorized_keys file already exists at $authorizedKeysPath."
|
||||
}
|
||||
Write-Host "OpenSSH server was successfully enabled."
|
||||
Write-Host "The config file can be located at C:\ProgramData\ssh\sshd_config "
|
||||
Write-Host "Add your public keys to this file -> $authorizedKeysPath"
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
function Invoke-WinUtilShowExt {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disables/Enables Show file Extentions
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Show file extentions
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Showing file extentions"
|
||||
$value = 0
|
||||
} else {
|
||||
Write-Host "hiding file extensions"
|
||||
$value = 1
|
||||
}
|
||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||
Set-ItemProperty -Path $Path -Name HideFileExt -Value $value
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
function Invoke-WinUtilSnapFlyout {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disables/Enables Snap Assist Flyout on startup
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Snap Assist Flyout on startup
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Enabling Snap Assist Flyout On startup"
|
||||
$value = 1
|
||||
} else {
|
||||
Write-Host "Disabling Snap Assist Flyout On startup"
|
||||
$value = 0
|
||||
}
|
||||
|
||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||
taskkill.exe /F /IM "explorer.exe"
|
||||
Set-ItemProperty -Path $Path -Name EnableSnapAssistFlyout -Value $value
|
||||
Start-Process "explorer.exe"
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
function Invoke-WinUtilSnapSuggestion {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disables/Enables Snap Assist Suggestions on startup
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Snap Assist Suggestions on startup
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Enabling Snap Assist Suggestion On startup"
|
||||
$value = 1
|
||||
} else {
|
||||
Write-Host "Disabling Snap Assist Suggestion On startup"
|
||||
$value = 0
|
||||
}
|
||||
# taskkill.exe /F /IM "explorer.exe"
|
||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||
taskkill.exe /F /IM "explorer.exe"
|
||||
Set-ItemProperty -Path $Path -Name SnapAssist -Value $value
|
||||
Start-Process "explorer.exe"
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
function Invoke-WinUtilSnapWindow {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disables/Enables Snapping Windows on startup
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Snapping Windows on startup
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Enabling Snap Windows On startup | Relogin Required"
|
||||
$value = 1
|
||||
} else {
|
||||
Write-Host "Disabling Snap Windows On startup | Relogin Required"
|
||||
$value = 0
|
||||
}
|
||||
$Path = "HKCU:\Control Panel\Desktop"
|
||||
Set-ItemProperty -Path $Path -Name WindowArrangementActive -Value $value
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
Function Invoke-WinUtilStickyKeys {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disables/Enables Sticky Keyss on startup
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Sticky Keys on startup
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Enabling Sticky Keys On startup"
|
||||
$value = 510
|
||||
} else {
|
||||
Write-Host "Disabling Sticky Keys On startup"
|
||||
$value = 58
|
||||
}
|
||||
$Path = "HKCU:\Control Panel\Accessibility\StickyKeys"
|
||||
Set-ItemProperty -Path $Path -Name Flags -Value $value
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
function Invoke-WinUtilTaskView {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Enable/Disable Task View
|
||||
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Task View
|
||||
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Enabling Task View"
|
||||
$value = 1
|
||||
} else {
|
||||
Write-Host "Disabling Task View"
|
||||
$value = 0
|
||||
}
|
||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||
Set-ItemProperty -Path $Path -Name ShowTaskViewButton -Value $value
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
function Invoke-WinUtilTaskbarAlignment {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Switches between Center & Left Taskbar Alignment
|
||||
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to make Taskbar Alignment Center or Left
|
||||
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Making Taskbar Alignment to the Center"
|
||||
$value = 1
|
||||
} else {
|
||||
Write-Host "Making Taskbar Alignment to the Left"
|
||||
$value = 0
|
||||
}
|
||||
$Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||
Set-ItemProperty -Path $Path -Name "TaskbarAl" -Value $value
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
function Invoke-WinUtilTaskbarSearch {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Enable/Disable Taskbar Search Button.
|
||||
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Taskbar Search Button.
|
||||
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Enabling Search Button"
|
||||
$value = 1
|
||||
} else {
|
||||
Write-Host "Disabling Search Button"
|
||||
$value = 0
|
||||
}
|
||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search\"
|
||||
Set-ItemProperty -Path $Path -Name SearchboxTaskbarMode -Value $value
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
function Invoke-WinUtilTaskbarWidgets {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Enable/Disable Taskbar Widgets
|
||||
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable Taskbar Widgets
|
||||
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Enabling Taskbar Widgets"
|
||||
$value = 1
|
||||
} else {
|
||||
Write-Host "Disabling Taskbar Widgets"
|
||||
$value = 0
|
||||
}
|
||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||
Set-ItemProperty -Path $Path -Name TaskbarDa -Value $value
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -21,6 +21,10 @@ function Invoke-WinUtilTweaks {
|
||||
$KeepServiceStartup = $true
|
||||
)
|
||||
|
||||
if ($Checkbox -contains "Toggle") {
|
||||
$CheckBox = $sync.configs.tweaks.$CheckBox
|
||||
}
|
||||
|
||||
Write-Debug "Tweaks: $($CheckBox)"
|
||||
if($undo) {
|
||||
$Values = @{
|
||||
@ -73,6 +77,14 @@ function Invoke-WinUtilTweaks {
|
||||
if($sync.configs.tweaks.$CheckBox.registry) {
|
||||
$sync.configs.tweaks.$CheckBox.registry | ForEach-Object {
|
||||
Write-Debug "$($psitem.Name) and state is $($psitem.$($values.registry))"
|
||||
if (($psitem.Path -imatch "hku") -and !(Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
|
||||
$null = (New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS)
|
||||
if (Get-PSDrive -Name HKU -ErrorAction SilentlyContinue) {
|
||||
Write-Debug "HKU drive created successfully"
|
||||
} else {
|
||||
Write-Debug "Failed to create HKU drive"
|
||||
}
|
||||
}
|
||||
Set-WinUtilRegistry -Name $psitem.Name -Path $psitem.Path -Type $psitem.Type -Value $psitem.$($values.registry)
|
||||
}
|
||||
}
|
||||
|
231
functions/private/Invoke-WinUtilUninstallPSProfile.ps1
Normal file
231
functions/private/Invoke-WinUtilUninstallPSProfile.ps1
Normal file
@ -0,0 +1,231 @@
|
||||
function Invoke-WinUtilUninstallPSProfile {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
# Uninstalls the CTT PowerShell profile then restores the original profile.
|
||||
#>
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PROFILE -DebugPreference $DebugPreference -ScriptBlock {
|
||||
# Remap the automatic built-in $PROFILE variable to the parameter named $PSProfile.
|
||||
param ($PSProfile)
|
||||
|
||||
# Helper function used to uninstall a specific Nerd Fonts font package.
|
||||
function Uninstall-NerdFonts {
|
||||
# Define the parameters block for the Uninstall-NerdFonts function.
|
||||
param (
|
||||
[string]$FontsPath = "$env:LOCALAPPDATA\Microsoft\Windows\Fonts",
|
||||
[string]$FontFamilyName = "CaskaydiaCoveNerdFont"
|
||||
)
|
||||
|
||||
# Get the list of installed fonts as specified by the FontFamilyName parameter.
|
||||
$Fonts = Get-ChildItem $FontsPath -Recurse -Filter "*.ttf" | Where-Object { $_.Name -match $FontFamilyName }
|
||||
|
||||
# Check if the specified fonts are currently installed on the system.
|
||||
if ($Fonts) {
|
||||
# Let the user know that the Nerd Fonts are currently being uninstalled.
|
||||
Write-Host "===> Uninstalling: Nerd Fonts... <===" -ForegroundColor Yellow
|
||||
|
||||
# Loop over the font files and remove each installed font file one-by-one.
|
||||
$Fonts | ForEach-Object {
|
||||
# Check if the font file exists on the disk before attempting to remove it.
|
||||
if (Test-Path "$($_.FullName)") {
|
||||
# Remove the found font files from the disk; uninstalling the font.
|
||||
Remove-Item "$($_.FullName)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Let the user know that the Nerd Fonts package has been uninstalled from the system.
|
||||
if (-not $Fonts) {
|
||||
Write-Host "===> Successfully Uninstalled: Nerd Fonts. <===" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Helper function used to uninstall a specific Nerd Fonts font corresponding registry keys.
|
||||
function Uninstall-NerdFontRegKeys {
|
||||
# Define the parameters block for the Uninstall-NerdFontsRegKey function.
|
||||
param (
|
||||
[string]$FontsRegPath = "HKCU:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts",
|
||||
[string]$FontFamilyName = "CaskaydiaCove"
|
||||
)
|
||||
|
||||
try {
|
||||
# Get all properties (font registrations) from the registry path
|
||||
$registryProperties = Get-ItemProperty -Path $FontsRegPath
|
||||
|
||||
# Filter and remove properties that match the font family name
|
||||
$registryProperties.PSObject.Properties |
|
||||
Where-Object { $_.Name -match $FontFamilyName } |
|
||||
ForEach-Object {
|
||||
If ($_.Name -like "*$FontFamilyName*") {
|
||||
Remove-ItemProperty -path $FontsRegPath -Name $_.Name -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Error removing registry keys: $($_.exception.message)" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
# Check if Chris Titus Tech's PowerShell profile is currently available in the PowerShell profile folder.
|
||||
if (Test-Path $PSProfile -PathType Leaf) {
|
||||
# Set the GitHub repo path used for looking up the name of Chris Titus Tech's powershell-profile repo.
|
||||
$GitHubRepoPath = "ChrisTitusTech/powershell-profile"
|
||||
|
||||
# Get the unique identifier used to test for the presence of Chris Titus Tech's PowerShell profile.
|
||||
$PSProfileIdentifier = (Invoke-RestMethod "https://api.github.com/repos/$GitHubRepoPath").full_name
|
||||
|
||||
# Check if Chris Titus Tech's PowerShell profile is currently installed in the PowerShell profile folder.
|
||||
if ((Get-Content $PSProfile) -match $PSProfileIdentifier) {
|
||||
# Attempt to uninstall Chris Titus Tech's PowerShell profile from the PowerShell profile folder.
|
||||
try {
|
||||
# Get the content of the backup PowerShell profile and store it in-memory.
|
||||
$PSProfileContent = Get-Content "$PSProfile.bak"
|
||||
|
||||
# Store the flag used to check if OhMyPosh is in use by the backup PowerShell profile.
|
||||
$OhMyPoshInUse = $PSProfileContent -match "oh-my-posh init"
|
||||
|
||||
# Check if OhMyPosh is not currently in use by the backup PowerShell profile.
|
||||
if (-not $OhMyPoshInUse) {
|
||||
# If OhMyPosh is currently installed attempt to uninstall it from the system.
|
||||
if (Get-Command oh-my-posh -ErrorAction SilentlyContinue) {
|
||||
# Let the user know that OhMyPosh is currently being uninstalled from their system.
|
||||
Write-Host "===> Uninstalling: OhMyPosh... <===" -ForegroundColor Yellow
|
||||
|
||||
# Attempt to uninstall OhMyPosh from the system with the WinGet package manager.
|
||||
winget uninstall -e --id JanDeDobbeleer.OhMyPosh
|
||||
}
|
||||
} else {
|
||||
# Let the user know that the uninstallation of OhMyPosh has been skipped because it is in use.
|
||||
Write-Host "===> Skipped Uninstall: OhMyPosh In-Use. <===" -ForegroundColor Yellow
|
||||
}
|
||||
} catch {
|
||||
# Let the user know that an error was encountered when uninstalling OhMyPosh.
|
||||
Write-Host "Failed to uninstall OhMyPosh. Error: $_" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Attempt to uninstall the specified Nerd Fonts package from the system.
|
||||
try {
|
||||
# Specify the directory that the specified font package will be uninstalled from.
|
||||
[string]$FontsPath = "$env:LOCALAPPDATA\Microsoft\Windows\Fonts"
|
||||
|
||||
# Specify the name of the font package that is to be uninstalled from the system.
|
||||
[string]$FontFamilyName = "CaskaydiaCoveNerdFont"
|
||||
|
||||
# Call the function used to uninstall the specified Nerd Fonts package from the system.
|
||||
Uninstall-NerdFonts -FontsPath $FontsPath -FontFamilyName $FontFamilyName
|
||||
|
||||
} catch {
|
||||
# Let the user know that an error was encountered when uninstalling Nerd Fonts.
|
||||
Write-Host "Failed to uninstall Nerd Fonts. Error: $_" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Attempt to uninstall the specified Nerd Fonts registry keys from the system.
|
||||
try {
|
||||
# Specify the registry path that the specified font registry keys will be uninstalled from.
|
||||
[string]$FontsRegPath = "HKCU:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"
|
||||
|
||||
# Specify the name of the font registry keys that is to be uninstalled from the system.
|
||||
[string]$FontFamilyName = "CaskaydiaCove"
|
||||
|
||||
# Call the function used to uninstall the specified Nerd Fonts registry keys from the system.
|
||||
Uninstall-NerdFontRegKeys -FontsPath $FontsRegPath -FontFamilyName $FontFamilyName
|
||||
|
||||
} catch {
|
||||
# Let the user know that an error was encountered when uninstalling Nerd Font registry keys.
|
||||
Write-Host "Failed to uninstall Nerd Font Registry Keys. Error: $_" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Attempt to uninstall the Terminal-Icons PowerShell module from the system.
|
||||
try {
|
||||
# Get the content of the backup PowerShell profile and store it in-memory.
|
||||
$PSProfileContent = Get-Content "$PSProfile.bak"
|
||||
|
||||
# Store the flag used to check if Terminal-Icons is in use by the backup PowerShell profile.
|
||||
$TerminalIconsInUse = $PSProfileContent -match "Import-Module" -and $PSProfileContent -match "Terminal-Icons"
|
||||
|
||||
# Check if Terminal-Icons is not currently in use by the backup PowerShell profile.
|
||||
if (-not $TerminalIconsInUse) {
|
||||
# If Terminal-Icons is currently installed attempt to uninstall it from the system.
|
||||
if (Get-Module -ListAvailable Terminal-Icons) {
|
||||
# Let the user know that Terminal-Icons is currently being uninstalled from their system.
|
||||
Write-Host "===> Uninstalling: Terminal-Icons... <===" -ForegroundColor Yellow
|
||||
|
||||
# Attempt to uninstall Terminal-Icons from the system with Uninstall-Module.
|
||||
Uninstall-Module -Name Terminal-Icons
|
||||
}
|
||||
} else {
|
||||
# Let the user know that the uninstallation of Terminal-Icons has been skipped because it is in use.
|
||||
Write-Host "===> Skipped Uninstall: Terminal-Icons In-Use. <===" -ForegroundColor Yellow
|
||||
}
|
||||
} catch {
|
||||
# Let the user know that an error was encountered when uninstalling Terminal-Icons.
|
||||
Write-Host "Failed to uninstall Terminal-Icons. Error: $_" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Attempt to uninstall the Zoxide application from the system.
|
||||
try {
|
||||
# Get the content of the backup PowerShell profile and store it in-memory.
|
||||
$PSProfileContent = Get-Content "$PSProfile.bak"
|
||||
|
||||
# Store the flag used to check if Zoxide is in use by the backup PowerShell profile.
|
||||
$ZoxideInUse = $PSProfileContent -match "zoxide init"
|
||||
|
||||
# Check if Zoxide is not currently in use by the backup PowerShell profile.
|
||||
if (-not $ZoxideInUse) {
|
||||
# If Zoxide is currently installed attempt to uninstall it from the system.
|
||||
if (Get-Command zoxide -ErrorAction SilentlyContinue) {
|
||||
# Let the user know that Zoxide is currently being uninstalled from their system.
|
||||
Write-Host "===> Uninstalling: Zoxide... <===" -ForegroundColor Yellow
|
||||
|
||||
# Attempt to uninstall Zoxide from the system with the WinGet package manager.
|
||||
winget uninstall -e --id ajeetdsouza.zoxide
|
||||
}
|
||||
} else {
|
||||
# Let the user know that the uninstallation of Zoxide been skipped because it is in use.
|
||||
Write-Host "===> Skipped Uninstall: Zoxide In-Use. <===" -ForegroundColor Yellow
|
||||
}
|
||||
} catch {
|
||||
# Let the user know that an error was encountered when uninstalling Zoxide.
|
||||
Write-Host "Failed to uninstall Zoxide. Error: $_" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Attempt to uninstall the CTT PowerShell profile from the system.
|
||||
try {
|
||||
# Try and remove the CTT PowerShell Profile file from the disk with Remove-Item.
|
||||
Remove-Item $PSProfile
|
||||
|
||||
# Let the user know that the CTT PowerShell profile has been uninstalled from the system.
|
||||
Write-Host "Profile has been uninstalled. Please restart your shell to reflect the changes!" -ForegroundColor Magenta
|
||||
} catch {
|
||||
# Let the user know that an error was encountered when uninstalling the profile.
|
||||
Write-Host "Failed to uninstall profile. Error: $_" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Attempt to move the user's original PowerShell profile backup back to its original location.
|
||||
try {
|
||||
# Check if the backup PowerShell profile exists before attempting to restore the backup.
|
||||
if (Test-Path "$PSProfile.bak") {
|
||||
# Restore the backup PowerShell profile and move it to its original location.
|
||||
Move-Item "$PSProfile.bak" $PSProfile
|
||||
|
||||
# Let the user know that their PowerShell profile backup has been successfully restored.
|
||||
Write-Host "===> Restored Profile Backup. <===" -ForegroundColor Yellow
|
||||
}
|
||||
} catch {
|
||||
# Let the user know that an error was encountered when restoring the profile backup.
|
||||
Write-Host "Failed to restore profile backup. Error: $_" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Silently cleanup the oldprofile.ps1 file that was created when the CTT PowerShell profile was installed.
|
||||
Remove-Item "$env:USERPROFILE\oldprofile.ps1" | Out-Null
|
||||
} else {
|
||||
# Let the user know that the CTT PowerShell profile is not installed and that the uninstallation was skipped.
|
||||
Write-Host "===> Chris Titus Tech's PowerShell Profile Not Found. Skipped Uninstallation. <===" -ForegroundColor Magenta
|
||||
}
|
||||
} else {
|
||||
# Let the user know that no PowerShell profile was found and that the uninstallation was skipped.
|
||||
Write-Host "===> No PowerShell Profile Found. Skipped Uninstallation. <===" -ForegroundColor Magenta
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
function Invoke-WinUtilVerboseLogon {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disables/Enables VerboseLogon Messages
|
||||
.PARAMETER Enabled
|
||||
Indicates whether to enable or disable VerboseLogon messages
|
||||
#>
|
||||
Param($Enabled)
|
||||
try {
|
||||
if ($Enabled -eq $false) {
|
||||
Write-Host "Enabling Verbose Logon Messages"
|
||||
$value = 1
|
||||
} else {
|
||||
Write-Host "Disabling Verbose Logon Messages"
|
||||
$value = 0
|
||||
}
|
||||
$Path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
|
||||
Set-ItemProperty -Path $Path -Name VerboseStatus -Value $value
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
function Invoke-WinUtilpsProfile {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs & applies the CTT Powershell Profile
|
||||
#>
|
||||
Invoke-WPFRunspace -Argumentlist $PROFILE -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param ( $psprofile)
|
||||
function Invoke-PSSetup {
|
||||
$url = "https://raw.githubusercontent.com/ChrisTitusTech/powershell-profile/main/Microsoft.PowerShell_profile.ps1"
|
||||
$oldhash = Get-FileHash $psprofile -ErrorAction SilentlyContinue
|
||||
Invoke-RestMethod $url -OutFile "$env:temp/Microsoft.PowerShell_profile.ps1"
|
||||
$newhash = Get-FileHash "$env:temp/Microsoft.PowerShell_profile.ps1"
|
||||
if ($newhash.Hash -ne $oldhash.Hash) {
|
||||
write-host "===> Installing Profile.. <===" -ForegroundColor Yellow
|
||||
# Starting new hidden shell process bc setup does not work in a runspace
|
||||
Start-Process -FilePath "pwsh" -ArgumentList "-ExecutionPolicy Bypass -NoProfile -Command `"Invoke-Expression (Invoke-WebRequest `'https://github.com/ChrisTitusTech/powershell-profile/raw/main/setup.ps1`')`"" -WindowStyle Hidden -Wait
|
||||
Write-Host "Profile has been installed. Please restart your shell to reflect changes!" -ForegroundColor Magenta
|
||||
write-host "===> Finished <===" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host "Profile is up to date" -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
|
||||
if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
|
||||
if ($PSVersionTable.PSVersion.Major -ge 7) {
|
||||
Invoke-PSSetup
|
||||
}
|
||||
else {
|
||||
write-host "Profile requires Powershell 7, which is currently installed but not used!" -ForegroundColor Red
|
||||
# Load the necessary assembly for Windows Forms
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
# Display the Yes/No message box
|
||||
$question = [System.Windows.Forms.MessageBox]::Show("Profile requires Powershell 7, which is currently installed but not used! Do you want to install Profile for Powershell 7?", "Question",
|
||||
[System.Windows.Forms.MessageBoxButtons]::YesNo,
|
||||
[System.Windows.Forms.MessageBoxIcon]::Question)
|
||||
|
||||
# Check the result
|
||||
if ($question -eq [System.Windows.Forms.DialogResult]::Yes) {
|
||||
Invoke-PSSetup
|
||||
}
|
||||
else {
|
||||
Write-Host "Not proceeding with the profile setup!"
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
write-host "Profile requires Powershell 7, which is not installed!" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
}
|
180
functions/private/Invoke-WinutilThemeChange.ps1
Normal file
180
functions/private/Invoke-WinutilThemeChange.ps1
Normal 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 system’s 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
|
||||
}
|
43
functions/private/Set-PackageManagerPreference.ps1
Normal file
43
functions/private/Set-PackageManagerPreference.ps1
Normal file
@ -0,0 +1,43 @@
|
||||
function Set-PackageManagerPreference {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the currently selected package manager to global "ManagerPreference" in sync.
|
||||
Also persists preference across Winutil restarts via preference.ini.
|
||||
|
||||
Reads from preference.ini if no argument sent.
|
||||
|
||||
.PARAMETER preferedPackageManager
|
||||
The PackageManager that was selected.
|
||||
#>
|
||||
param(
|
||||
[Parameter(Position=0, Mandatory=$false)]
|
||||
[PackageManagers]$preferedPackageManager
|
||||
)
|
||||
|
||||
$preferencePath = "$env:LOCALAPPDATA\winutil\preferences.ini"
|
||||
$oldChocoPath = "$env:LOCALAPPDATA\winutil\preferChocolatey.ini"
|
||||
|
||||
#Try loading from file if no argument given.
|
||||
if ($null -eq $preferedPackageManager) {
|
||||
# Backwards compat for preferChocolatey.ini
|
||||
if (Test-Path -Path $oldChocoPath) {
|
||||
$preferedPackageManager = [PackageManagers]::Choco
|
||||
Remove-Item -Path $oldChocoPath
|
||||
}
|
||||
elseif (Test-Path -Path $preferencePath) {
|
||||
$potential = Get-Content -Path $preferencePath -TotalCount 1
|
||||
$preferedPackageManager = [PackageManagers]$potential
|
||||
}
|
||||
else {
|
||||
Write-Debug "Creating new preference file, defaulting to winget."
|
||||
$preferedPackageManager = [PackageManagers]::Winget
|
||||
}
|
||||
}
|
||||
|
||||
$sync["ManagerPreference"] = [PackageManagers]::$preferedPackageManager
|
||||
Write-Debug "Manager Preference changed to '$($sync["ManagerPreference"])'"
|
||||
|
||||
|
||||
# Write preference to file to persist across restarts.
|
||||
Out-File -FilePath $preferencePath -InputObject $sync["ManagerPreference"]
|
||||
}
|
@ -35,12 +35,20 @@ function Set-WinUtilRegistry {
|
||||
New-Item -Path $Path -Force -ErrorAction Stop | Out-Null
|
||||
}
|
||||
|
||||
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>") {
|
||||
Write-Host "Set $Path\$Name to $Value"
|
||||
Set-ItemProperty -Path $Path -Name $Name -Type $Type -Value $Value -Force -ErrorAction Stop | Out-Null
|
||||
}
|
||||
else{
|
||||
Write-Host "Remove $Path\$Name"
|
||||
Remove-ItemProperty -Path $Path -Name $Name -Force -ErrorAction Stop | Out-Null
|
||||
}
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
Write-Warning $psitem.Exception.ErrorRecord
|
||||
} catch [System.UnauthorizedAccessException] {
|
||||
Write-Warning $psitem.Exception.Message
|
||||
} catch {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
|
@ -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);
|
||||
}
|
@ -6,6 +6,9 @@ function Show-CustomDialog {
|
||||
.DESCRIPTION
|
||||
This function creates a custom dialog box with the specified message and additional elements such as an image, heading, and an OK button. The dialog box is designed with a green border, rounded corners, and a black background.
|
||||
|
||||
.PARAMETER Title
|
||||
The Title to use for the dialog window's Title Bar, this will not be visible by the user, as window styling is set to None.
|
||||
|
||||
.PARAMETER Message
|
||||
The message to be displayed in the dialog box.
|
||||
|
||||
@ -16,60 +19,102 @@ function Show-CustomDialog {
|
||||
The height of the custom dialog window.
|
||||
|
||||
.PARAMETER FontSize
|
||||
The Font Size for text shown inside the custom dialog window.
|
||||
The Font Size of message shown inside custom dialog window.
|
||||
|
||||
.PARAMETER HeaderFontSize
|
||||
The Font Size for the Header of the custom dialog window.
|
||||
The Font Size for the Header of custom dialog window.
|
||||
|
||||
.PARAMETER IconSize
|
||||
The Size to use for Icon inside the custom dialog window.
|
||||
.PARAMETER LogoSize
|
||||
The Size of the Logo used inside the custom dialog window.
|
||||
|
||||
.PARAMETER ForegroundColor
|
||||
The Foreground Color of dialog window title & message.
|
||||
|
||||
.PARAMETER BackgroundColor
|
||||
The Background Color of dialog window.
|
||||
|
||||
.PARAMETER BorderColor
|
||||
The Color for dialog window border.
|
||||
|
||||
.PARAMETER ButtonBackgroundColor
|
||||
The Background Color for Buttons in dialog window.
|
||||
|
||||
.PARAMETER ButtonForegroundColor
|
||||
The Foreground Color for Buttons in dialog window.
|
||||
|
||||
.PARAMETER ShadowColor
|
||||
The Color used when creating the Drop-down Shadow effect for dialog window.
|
||||
|
||||
.PARAMETER LogoColor
|
||||
The Color of WinUtil Text found next to WinUtil's Logo inside dialog window.
|
||||
|
||||
.PARAMETER LinkForegroundColor
|
||||
The Foreground Color for Links inside dialog window.
|
||||
|
||||
.PARAMETER LinkHoverForegroundColor
|
||||
The Foreground Color for Links when the mouse pointer hovers over them inside dialog window.
|
||||
|
||||
.PARAMETER EnableScroll
|
||||
A flag indicating whether to enable scrolling if the content exceeds the window size.
|
||||
|
||||
.EXAMPLE
|
||||
Show-CustomDialog -Message "This is a custom dialog with a message and an image above." -Width 300 -Height 200
|
||||
Show-CustomDialog -Title "My Custom Dialog" -Message "This is a custom dialog with a message and an image above." -Width 300 -Height 200
|
||||
|
||||
Makes a new Custom Dialog with the title 'My Custom Dialog' and a message 'This is a custom dialog with a message and an image above.', with dimensions of 300 by 200 pixels.
|
||||
Other styling options are grabbed from '$sync.Form.Resources' global variable.
|
||||
|
||||
.EXAMPLE
|
||||
$foregroundColor = New-Object System.Windows.Media.SolidColorBrush("#0088e5")
|
||||
$backgroundColor = New-Object System.Windows.Media.SolidColorBrush("#1e1e1e")
|
||||
$linkForegroundColor = New-Object System.Windows.Media.SolidColorBrush("#0088e5")
|
||||
$linkHoverForegroundColor = New-Object System.Windows.Media.SolidColorBrush("#005289")
|
||||
Show-CustomDialog -Title "My Custom Dialog" -Message "This is a custom dialog with a message and an image above." -Width 300 -Height 200 -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -LinkForegroundColor $linkForegroundColor -LinkHoverForegroundColor $linkHoverForegroundColor
|
||||
|
||||
Makes a new Custom Dialog with the title 'My Custom Dialog' and a message 'This is a custom dialog with a message and an image above.', with dimensions of 300 by 200 pixels, with a link foreground (and general foreground) colors of '#0088e5', background color of '#1e1e1e', and Link Color on Hover of '005289', all of which are in Hexadecimal (the '#' Symbol is required by SolidColorBrush Constructor).
|
||||
Other styling options are grabbed from '$sync.Form.Resources' global variable.
|
||||
|
||||
#>
|
||||
param(
|
||||
[string]$Title,
|
||||
[string]$Message,
|
||||
[int]$Width = 300,
|
||||
[int]$Height = 200,
|
||||
[int]$FontSize = 10,
|
||||
[int]$HeaderFontSize = 14,
|
||||
[int]$IconSize = 25,
|
||||
[int]$Width = $sync.Form.Resources.CustomDialogWidth,
|
||||
[int]$Height = $sync.Form.Resources.CustomDialogHeight,
|
||||
|
||||
[System.Windows.Media.FontFamily]$FontFamily = $sync.Form.Resources.FontFamily,
|
||||
[int]$FontSize = $sync.Form.Resources.CustomDialogFontSize,
|
||||
[int]$HeaderFontSize = $sync.Form.Resources.CustomDialogFontSizeHeader,
|
||||
[int]$LogoSize = $sync.Form.Resources.CustomDialogLogoSize,
|
||||
|
||||
[System.Windows.Media.Color]$ShadowColor = "#AAAAAAAA",
|
||||
[System.Windows.Media.SolidColorBrush]$LogoColor = $sync.Form.Resources.LabelboxForegroundColor,
|
||||
[System.Windows.Media.SolidColorBrush]$BorderColor = $sync.Form.Resources.BorderColor,
|
||||
[System.Windows.Media.SolidColorBrush]$ForegroundColor = $sync.Form.Resources.MainForegroundColor,
|
||||
[System.Windows.Media.SolidColorBrush]$BackgroundColor = $sync.Form.Resources.MainBackgroundColor,
|
||||
[System.Windows.Media.SolidColorBrush]$ButtonForegroundColor = $sync.Form.Resources.ButtonInstallForegroundColor,
|
||||
[System.Windows.Media.SolidColorBrush]$ButtonBackgroundColor = $sync.Form.Resources.ButtonInstallBackgroundColor,
|
||||
[System.Windows.Media.SolidColorBrush]$LinkForegroundColor = $sync.Form.Resources.LinkForegroundColor,
|
||||
[System.Windows.Media.SolidColorBrush]$LinkHoverForegroundColor = $sync.Form.Resources.LinkHoverForegroundColor,
|
||||
|
||||
[bool]$EnableScroll = $false
|
||||
)
|
||||
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
|
||||
# Define theme colors
|
||||
$foregroundColor = $sync.configs.themes.$ctttheme.MainForegroundColor
|
||||
$backgroundColor = $sync.configs.themes.$ctttheme.MainBackgroundColor
|
||||
$font = New-Object Windows.Media.FontFamily("Consolas")
|
||||
$borderColor = $sync.configs.themes.$ctttheme.BorderColor # ButtonInstallBackgroundColor
|
||||
$buttonBackgroundColor = $sync.configs.themes.$ctttheme.ButtonInstallBackgroundColor
|
||||
$buttonForegroundColor = $sync.configs.themes.$ctttheme.ButtonInstallForegroundColor
|
||||
$shadowColor = [Windows.Media.ColorConverter]::ConvertFromString("#AAAAAAAA")
|
||||
$logocolor = $sync.configs.themes.$ctttheme.LabelboxForegroundColor
|
||||
|
||||
# Create a custom dialog window
|
||||
$dialog = New-Object Windows.Window
|
||||
$dialog.Title = "About"
|
||||
$dialog.Title = $Title
|
||||
$dialog.Height = $Height
|
||||
$dialog.Width = $Width
|
||||
$dialog.Margin = New-Object Windows.Thickness(10) # Add margin to the entire dialog box
|
||||
$dialog.WindowStyle = [Windows.WindowStyle]::None # Remove title bar and window controls
|
||||
$dialog.ResizeMode = [Windows.ResizeMode]::NoResize # Disable resizing
|
||||
$dialog.WindowStartupLocation = [Windows.WindowStartupLocation]::CenterScreen # Center the window
|
||||
$dialog.Foreground = $foregroundColor
|
||||
$dialog.Background = $backgroundColor
|
||||
$dialog.FontFamily = $font
|
||||
$dialog.Foreground = $ForegroundColor
|
||||
$dialog.Background = $BackgroundColor
|
||||
$dialog.FontFamily = $FontFamily
|
||||
$dialog.FontSize = $FontSize
|
||||
|
||||
# Create a Border for the green edge with rounded corners
|
||||
$border = New-Object Windows.Controls.Border
|
||||
$border.BorderBrush = $borderColor
|
||||
$border.BorderBrush = $BorderColor
|
||||
$border.BorderThickness = New-Object Windows.Thickness(1) # Adjust border thickness as needed
|
||||
$border.CornerRadius = New-Object Windows.CornerRadius(10) # Adjust the radius for rounded corners
|
||||
|
||||
@ -89,7 +134,7 @@ function Show-CustomDialog {
|
||||
$grid = New-Object Windows.Controls.Grid
|
||||
$border.Child = $grid
|
||||
|
||||
# Add the following line to show gridlines
|
||||
# Uncomment the following line to show gridlines
|
||||
#$grid.ShowGridLines = $true
|
||||
|
||||
# Add the following line to set the background color of the grid
|
||||
@ -102,7 +147,6 @@ function Show-CustomDialog {
|
||||
$border.HorizontalAlignment = [Windows.HorizontalAlignment]::Stretch
|
||||
$border.VerticalAlignment = [Windows.VerticalAlignment]::Stretch
|
||||
|
||||
|
||||
# Set up Row Definitions
|
||||
$row0 = New-Object Windows.Controls.RowDefinition
|
||||
$row0.Height = [Windows.GridLength]::Auto
|
||||
@ -129,17 +173,18 @@ function Show-CustomDialog {
|
||||
[Windows.Controls.Grid]::SetRow($stackPanel, 0) # Set the row to the second row (0-based index)
|
||||
|
||||
# Add SVG path to the stack panel
|
||||
$stackPanel.Children.Add((Invoke-WinUtilAssets -Type "logo" -Size 25))
|
||||
$stackPanel.Children.Add((Invoke-WinUtilAssets -Type "logo" -Size $LogoSize))
|
||||
|
||||
# Add "Winutil" text
|
||||
$winutilTextBlock = New-Object Windows.Controls.TextBlock
|
||||
$winutilTextBlock.Text = "Winutil"
|
||||
$winutilTextBlock.FontSize = $HeaderFontSize
|
||||
$winutilTextBlock.Foreground = $logocolor
|
||||
$winutilTextBlock.Foreground = $LogoColor
|
||||
$winutilTextBlock.Margin = New-Object Windows.Thickness(10, 10, 10, 5) # Add margins around the text block
|
||||
$stackPanel.Children.Add($winutilTextBlock)
|
||||
# Add TextBlock for information with text wrapping and margins
|
||||
$messageTextBlock = New-Object Windows.Controls.TextBlock
|
||||
$messageTextBlock.FontSize = $FontSize
|
||||
$messageTextBlock.TextWrapping = [Windows.TextWrapping]::Wrap # Enable text wrapping
|
||||
$messageTextBlock.HorizontalAlignment = [Windows.HorizontalAlignment]::Left
|
||||
$messageTextBlock.VerticalAlignment = [Windows.VerticalAlignment]::Top
|
||||
@ -162,7 +207,7 @@ function Show-CustomDialog {
|
||||
$hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value)
|
||||
$hyperlink.Inlines.Add($match.Groups[2].Value)
|
||||
$hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline
|
||||
$hyperlink.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor
|
||||
$hyperlink.Foreground = $LinkForegroundColor
|
||||
|
||||
$hyperlink.Add_Click({
|
||||
param($sender, $args)
|
||||
@ -170,11 +215,15 @@ function Show-CustomDialog {
|
||||
})
|
||||
$hyperlink.Add_MouseEnter({
|
||||
param($sender, $args)
|
||||
$sender.Foreground = $sync.configs.themes.$ctttheme.LinkHoverForegroundColor
|
||||
$sender.Foreground = $LinkHoverForegroundColor
|
||||
$sender.FontSize = ($FontSize + ($FontSize / 4))
|
||||
$sender.FontWeight = "SemiBold"
|
||||
})
|
||||
$hyperlink.Add_MouseLeave({
|
||||
param($sender, $args)
|
||||
$sender.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor
|
||||
$sender.Foreground = $LinkForegroundColor
|
||||
$sender.FontSize = $FontSize
|
||||
$sender.FontWeight = "Normal"
|
||||
})
|
||||
|
||||
$messageTextBlock.Inlines.Add($hyperlink)
|
||||
@ -218,7 +267,7 @@ function Show-CustomDialog {
|
||||
$okButton.Margin = New-Object Windows.Thickness(0, 0, 0, 10)
|
||||
$okButton.Background = $buttonBackgroundColor
|
||||
$okButton.Foreground = $buttonForegroundColor
|
||||
$okButton.BorderBrush = $borderColor
|
||||
$okButton.BorderBrush = $BorderColor
|
||||
$okButton.Add_Click({
|
||||
$dialog.Close()
|
||||
})
|
||||
|
@ -23,14 +23,22 @@ function Test-WinUtilPackageManager {
|
||||
# Check if Winget is available while getting it's Version if it's available
|
||||
$wingetExists = $true
|
||||
try {
|
||||
$wingetVersionFull = winget --version
|
||||
$wingetInfo = winget --info
|
||||
# Extract the package version from the output
|
||||
$wingetVersionFull = ($wingetInfo | Select-String -Pattern 'Microsoft\.DesktopAppInstaller v\d+\.\d+\.\d+\.\d+').Matches.Value
|
||||
if ($wingetVersionFull) {
|
||||
$wingetVersionFull = $wingetVersionFull.Split(' ')[-1].TrimStart('v')
|
||||
} else {
|
||||
# Fallback in case the pattern isn't found
|
||||
$wingetVersionFull = ($wingetInfo | Select-String -Pattern 'Package Manager v\d+\.\d+\.\d+').Matches.Value.Split(' ')[-1]
|
||||
}
|
||||
} catch [System.Management.Automation.CommandNotFoundException], [System.Management.Automation.ApplicationFailedException] {
|
||||
Write-Warning "Winget was not found due to un-availablity reasons"
|
||||
$wingetExists = $false
|
||||
} catch {
|
||||
Write-Warning "Winget was not found due to un-known reasons, The Stack Trace is:`n$($psitem.Exception.StackTrace)"
|
||||
$wingetExists = $false
|
||||
}
|
||||
}
|
||||
|
||||
# If Winget is available, Parse it's Version and give proper information to Terminal Output.
|
||||
# If it isn't available, the return of this funtion will be "not-installed", indicating that
|
||||
@ -48,13 +56,14 @@ function Test-WinUtilPackageManager {
|
||||
# Check if Winget's Version is too old.
|
||||
$wingetCurrentVersion = [System.Version]::Parse($wingetVersion.Trim('v'))
|
||||
# Grabs the latest release of Winget from the Github API for version check process.
|
||||
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/Winget-cli/releases/latest" -Method Get -ErrorAction Stop
|
||||
$wingetLatestVersion = [System.Version]::Parse(($response.tag_name).Trim('v')) #Stores version number of latest release.
|
||||
$wingetOutdated = $wingetCurrentVersion -lt $wingetLatestVersion
|
||||
$response = winget search -e Microsoft.AppInstaller --accept-source-agreements
|
||||
$wingetLatestVersion = ($response | Select-String -Pattern '\d+\.\d+\.\d+\.\d+').Matches.Value
|
||||
Write-Host "Latest Search Version: $wingetLatestVersion" -ForegroundColor White
|
||||
Write-Host "Current Installed Version: $wingetCurrentVersion" -ForegroundColor White
|
||||
$wingetOutdated = $wingetCurrentVersion -lt [System.Version]::Parse($wingetLatestVersion)
|
||||
Write-Host "===========================================" -ForegroundColor Green
|
||||
Write-Host "--- Winget is installed ---" -ForegroundColor Green
|
||||
Write-Host "===========================================" -ForegroundColor Green
|
||||
Write-Host "Version: $wingetVersionFull" -ForegroundColor White
|
||||
|
||||
if (!$wingetPreview) {
|
||||
Write-Host " - Winget is a release version." -ForegroundColor Green
|
||||
|
120
functions/public/Initialize-WPFUI.ps1
Normal file
120
functions/public/Initialize-WPFUI.ps1
Normal file
@ -0,0 +1,120 @@
|
||||
function Initialize-WPFUI {
|
||||
[OutputType([void])]
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string]$TargetGridName
|
||||
)
|
||||
|
||||
switch ($TargetGridName) {
|
||||
"appscategory"{
|
||||
# TODO
|
||||
# Switch UI generation of the sidebar to this function
|
||||
# $sync.ItemsControl = Initialize-InstallAppArea -TargetElement $TargetGridName
|
||||
# ...
|
||||
|
||||
# Create and configure a popup for displaying selected apps
|
||||
$selectedAppsPopup = New-Object Windows.Controls.Primitives.Popup
|
||||
$selectedAppsPopup.IsOpen = $false
|
||||
$selectedAppsPopup.PlacementTarget = $sync.WPFselectedAppsButton
|
||||
$selectedAppsPopup.Placement = [System.Windows.Controls.Primitives.PlacementMode]::Bottom
|
||||
$selectedAppsPopup.AllowsTransparency = $true
|
||||
|
||||
# Style the popup with a border and background
|
||||
$selectedAppsBorder = New-Object Windows.Controls.Border
|
||||
$selectedAppsBorder.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "MainBackgroundColor")
|
||||
$selectedAppsBorder.SetResourceReference([Windows.Controls.Control]::BorderBrushProperty, "MainForegroundColor")
|
||||
$selectedAppsBorder.SetResourceReference([Windows.Controls.Control]::BorderThicknessProperty, "ButtonBorderThickness")
|
||||
$selectedAppsBorder.Width = 200
|
||||
$selectedAppsBorder.Padding = 5
|
||||
$selectedAppsPopup.Child = $selectedAppsBorder
|
||||
$sync.selectedAppsPopup = $selectedAppsPopup
|
||||
|
||||
# Add a stack panel inside the popup's border to organize its child elements
|
||||
$sync.selectedAppsstackPanel = New-Object Windows.Controls.StackPanel
|
||||
$selectedAppsBorder.Child = $sync.selectedAppsstackPanel
|
||||
|
||||
# Close selectedAppsPopup when mouse leaves both button and selectedAppsPopup
|
||||
$sync.WPFselectedAppsButton.Add_MouseLeave({
|
||||
if (-not $sync.selectedAppsPopup.IsMouseOver) {
|
||||
$sync.selectedAppsPopup.IsOpen = $false
|
||||
}
|
||||
})
|
||||
$selectedAppsPopup.Add_MouseLeave({
|
||||
if (-not $sync.WPFselectedAppsButton.IsMouseOver) {
|
||||
$sync.selectedAppsPopup.IsOpen = $false
|
||||
}
|
||||
})
|
||||
|
||||
# Creates the popup that is displayed when the user right-clicks on an app entry
|
||||
# This popup contains buttons for installing, uninstalling, and viewing app information
|
||||
|
||||
$appPopup = New-Object Windows.Controls.Primitives.Popup
|
||||
$appPopup.StaysOpen = $false
|
||||
$appPopup.Placement = [System.Windows.Controls.Primitives.PlacementMode]::Bottom
|
||||
$appPopup.AllowsTransparency = $true
|
||||
# Store the popup globally so the position can be set later
|
||||
$sync.appPopup = $appPopup
|
||||
|
||||
$appPopupStackPanel = New-Object Windows.Controls.StackPanel
|
||||
$appPopupStackPanel.Orientation = "Horizontal"
|
||||
$appPopupStackPanel.Add_MouseLeave({
|
||||
$sync.appPopup.IsOpen = $false
|
||||
})
|
||||
$appPopup.Child = $appPopupStackPanel
|
||||
|
||||
$appButtons = @(
|
||||
[PSCustomObject]@{ Name = "Install"; Icon = [char]0xE118 },
|
||||
[PSCustomObject]@{ Name = "Uninstall"; Icon = [char]0xE74D },
|
||||
[PSCustomObject]@{ Name = "Info"; Icon = [char]0xE946 }
|
||||
)
|
||||
foreach ($button in $appButtons) {
|
||||
$newButton = New-Object Windows.Controls.Button
|
||||
$newButton.Style = $sync.Form.Resources.AppEntryButtonStyle
|
||||
$newButton.Content = $button.Icon
|
||||
$appPopupStackPanel.Children.Add($newButton) | Out-Null
|
||||
|
||||
# Dynamically load the selected app object so the buttons can be reused and do not need to be created for each app
|
||||
switch ($button.Name) {
|
||||
"Install" {
|
||||
$newButton.Add_MouseEnter({
|
||||
$appObject = $sync.configs.applicationsHashtable.$($sync.appPopupSelectedApp)
|
||||
$this.ToolTip = "Install or Upgrade $($appObject.content)"
|
||||
})
|
||||
$newButton.Add_Click({
|
||||
$appObject = $sync.configs.applicationsHashtable.$($sync.appPopupSelectedApp)
|
||||
Invoke-WPFInstall -PackagesToInstall $appObject
|
||||
})
|
||||
}
|
||||
"Uninstall" {
|
||||
$newButton.Add_MouseEnter({
|
||||
$appObject = $sync.configs.applicationsHashtable.$($sync.appPopupSelectedApp)
|
||||
$this.ToolTip = "Uninstall $($appObject.content)"
|
||||
})
|
||||
$newButton.Add_Click({
|
||||
$appObject = $sync.configs.applicationsHashtable.$($sync.appPopupSelectedApp)
|
||||
Invoke-WPFUnInstall -PackagesToUninstall $appObject
|
||||
})
|
||||
}
|
||||
"Info" {
|
||||
$newButton.Add_MouseEnter({
|
||||
$appObject = $sync.configs.applicationsHashtable.$($sync.appPopupSelectedApp)
|
||||
$this.ToolTip = "Open the application's website in your default browser`n$($appObject.link)"
|
||||
})
|
||||
$newButton.Add_Click({
|
||||
$appObject = $sync.configs.applicationsHashtable.$($sync.appPopupSelectedApp)
|
||||
Start-Process $appObject.link
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"appspanel" {
|
||||
$sync.ItemsControl = Initialize-InstallAppArea -TargetElement $TargetGridName
|
||||
Initialize-InstallCategoryAppList -TargetElement $sync.ItemsControl -Apps $sync.configs.applicationsHashtable
|
||||
}
|
||||
default {
|
||||
Write-Output "$TargetGridName not yet implemented"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ function Invoke-WPFButton {
|
||||
}
|
||||
|
||||
Switch -Wildcard ($Button) {
|
||||
|
||||
"WPFTab?BT" {Invoke-WPFTab $Button}
|
||||
"WPFInstall" {Invoke-WPFInstall}
|
||||
"WPFUninstall" {Invoke-WPFUnInstall}
|
||||
@ -34,7 +33,7 @@ function Invoke-WPFButton {
|
||||
"WPFRemoveUltPerf" {Invoke-WPFUltimatePerformance -State "Disable"}
|
||||
"WPFundoall" {Invoke-WPFundoall}
|
||||
"WPFFeatureInstall" {Invoke-WPFFeatureInstall}
|
||||
"WPFPanelDISM" {Invoke-WPFPanelDISM}
|
||||
"WPFPanelDISM" {Invoke-WPFSystemRepair}
|
||||
"WPFPanelAutologin" {Invoke-WPFPanelAutologin}
|
||||
"WPFPanelcontrol" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelnetwork" {Invoke-WPFControlPanel -Panel $button}
|
||||
@ -44,7 +43,8 @@ function Invoke-WPFButton {
|
||||
"WPFPanelprinter" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelsystem" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPaneluser" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFUpdatesdefault" {Invoke-WPFUpdatesdefault}
|
||||
"WPFPanelGodMode" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFUpdatesdefault" {Invoke-WPFFixesUpdate}
|
||||
"WPFFixesUpdate" {Invoke-WPFFixesUpdate}
|
||||
"WPFFixesWinget" {Invoke-WPFFixesWinget}
|
||||
"WPFRunAdobeCCCleanerTool" {Invoke-WPFRunAdobeCCCleanerTool}
|
||||
@ -54,10 +54,13 @@ function Invoke-WPFButton {
|
||||
"WPFWinUtilShortcut" {Invoke-WPFShortcut -ShortcutToAdd "WinUtil" -RunAsAdmin $true}
|
||||
"WPFGetInstalled" {Invoke-WPFGetInstalled -CheckBox "winget"}
|
||||
"WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"}
|
||||
"WPFGetIso" {Invoke-WPFGetIso}
|
||||
"WPFMicrowin" {Invoke-WPFMicrowin}
|
||||
"WPFGetIso" {Invoke-MicrowinGetIso}
|
||||
"WPFMicrowin" {Invoke-Microwin}
|
||||
"WPFCloseButton" {Invoke-WPFCloseButton}
|
||||
"MicrowinScratchDirBT" {Invoke-ScratchDialog}
|
||||
"WPFWinUtilPSProfile" {Invoke-WinUtilpsProfile}
|
||||
"WPFWinUtilInstallPSProfile" {Invoke-WinUtilInstallPSProfile}
|
||||
"WPFWinUtilUninstallPSProfile" {Invoke-WinUtilUninstallPSProfile}
|
||||
"WPFWinUtilSSHServer" {Invoke-WPFSSHServer}
|
||||
"WPFselectedAppsButton" {$sync.selectedAppsPopup.IsOpen = -not $sync.selectedAppsPopup.IsOpen}
|
||||
}
|
||||
}
|
||||
|
@ -19,5 +19,6 @@ function Invoke-WPFControlPanel {
|
||||
"WPFPanelprinter" {Start-Process "shell:::{A8A91A66-3A7D-4424-8D24-04E180695C7A}"}
|
||||
"WPFPanelsystem" {cmd /c sysdm.cpl}
|
||||
"WPFPaneluser" {cmd /c "control userpasswords2"}
|
||||
"WPFPanelGodMode" {Start-Process "shell:::{ED7BA470-8E54-465E-825C-99712043E01C}"}
|
||||
}
|
||||
}
|
||||
|
@ -6,19 +6,7 @@ function Invoke-WPFFixesUpdate {
|
||||
Performs various tasks in an attempt to repair Windows Update
|
||||
|
||||
.DESCRIPTION
|
||||
1. (Aggressive Only) Scans the system for corruption using chkdsk, SFC, and DISM
|
||||
Steps:
|
||||
1. Runs chkdsk /scan /perf
|
||||
/scan - Runs an online scan on the volume
|
||||
/perf - Uses more system resources to complete a scan as fast as possible
|
||||
2. Runs SFC /scannow
|
||||
/scannow - Scans integrity of all protected system files and repairs files with problems when possible
|
||||
3. Runs DISM /Online /Cleanup-Image /RestoreHealth
|
||||
/Online - Targets the running operating system
|
||||
/Cleanup-Image - Performs cleanup and recovery operations on the image
|
||||
/RestoreHealth - Scans the image for component store corruption and attempts to repair the corruption using Windows Update
|
||||
4. Runs SFC /scannow
|
||||
Ran twice in case DISM repaired SFC
|
||||
1. (Aggressive Only) Scans the system for corruption using the Invoke-WPFSystemRepair function
|
||||
2. Stops Windows Update Services
|
||||
3. Remove the QMGR Data file, which stores BITS jobs
|
||||
4. (Aggressive Only) Renames the DataStore and CatRoot2 folders
|
||||
@ -46,104 +34,7 @@ function Invoke-WPFFixesUpdate {
|
||||
Start-Sleep -Milliseconds 200
|
||||
|
||||
if ($Aggressive) {
|
||||
# Scan system for corruption
|
||||
Write-Progress -Id 0 -Activity "Repairing Windows Update" -Status "Scanning for corruption..." -PercentComplete 0
|
||||
Write-Progress -Id 1 -ParentId 0 -Activity "Scanning for corruption" -Status "Running chkdsk..." -PercentComplete 0
|
||||
# 2>&1 redirects stdout, alowing iteration over the output
|
||||
chkdsk.exe /scan /perf 2>&1 | ForEach-Object {
|
||||
# Write stdout to the Verbose stream
|
||||
Write-Verbose $_
|
||||
|
||||
# Get the index of the total percentage
|
||||
$index = $_.IndexOf("Total:")
|
||||
if (
|
||||
# If the percent is found
|
||||
($percent = try {(
|
||||
$_.Substring(
|
||||
$index + 6,
|
||||
$_.IndexOf("%", $index) - $index - 6
|
||||
)
|
||||
).Trim()} catch {0}) `
|
||||
<# And the current percentage is greater than the previous one #>`
|
||||
-and $percent -gt $oldpercent
|
||||
) {
|
||||
# Update the progress bar
|
||||
$oldpercent = $percent
|
||||
Write-Progress -Id 1 -ParentId 0 -Activity "Scanning for corruption" -Status "Running chkdsk... ($percent%)" -PercentComplete $percent
|
||||
}
|
||||
}
|
||||
|
||||
Write-Progress -Id 1 -ParentId 0 -Activity "Scanning for corruption" -Status "Running SFC..." -PercentComplete 0
|
||||
$oldpercent = 0
|
||||
# SFC has a bug when redirected which causes it to output only when the stdout buffer is full, causing the progress bar to move in chunks
|
||||
sfc /scannow 2>&1 | ForEach-Object {
|
||||
# Write stdout to the Verbose stream
|
||||
Write-Verbose $_
|
||||
|
||||
# Filter for lines that contain a percentage that is greater than the previous one
|
||||
if (
|
||||
(
|
||||
# Use a different method to get the percentage that accounts for SFC's Unicode output
|
||||
[int]$percent = try {(
|
||||
(
|
||||
$_.Substring(
|
||||
$_.IndexOf("n") + 2,
|
||||
$_.IndexOf("%") - $_.IndexOf("n") - 2
|
||||
).ToCharArray() | Where-Object {$_}
|
||||
) -join ''
|
||||
).TrimStart()} catch {0}
|
||||
) -and $percent -gt $oldpercent
|
||||
) {
|
||||
# Update the progress bar
|
||||
$oldpercent = $percent
|
||||
Write-Progress -Id 1 -ParentId 0 -Activity "Scanning for corruption" -Status "Running SFC... ($percent%)" -PercentComplete $percent
|
||||
}
|
||||
}
|
||||
|
||||
Write-Progress -Id 1 -ParentId 0 -Activity "Scanning for corruption" -Status "Running DISM..." -PercentComplete 0
|
||||
$oldpercent = 0
|
||||
DISM /Online /Cleanup-Image /RestoreHealth | ForEach-Object {
|
||||
# Write stdout to the Verbose stream
|
||||
Write-Verbose $_
|
||||
|
||||
# Filter for lines that contain a percentage that is greater than the previous one
|
||||
if (
|
||||
($percent = try {
|
||||
[int]($_ -replace "\[" -replace "=" -replace " " -replace "%" -replace "\]")
|
||||
} catch {0}) `
|
||||
-and $percent -gt $oldpercent
|
||||
) {
|
||||
# Update the progress bar
|
||||
$oldpercent = $percent
|
||||
Write-Progress -Id 1 -ParentId 0 -Activity "Scanning for corruption" -Status "Running DISM... ($percent%)" -PercentComplete $percent
|
||||
}
|
||||
}
|
||||
|
||||
Write-Progress -Id 1 -ParentId 0 -Activity "Scanning for corruption" -Status "Running SFC again..." -PercentComplete 0
|
||||
$oldpercent = 0
|
||||
sfc /scannow 2>&1 | ForEach-Object {
|
||||
# Write stdout to the Verbose stream
|
||||
Write-Verbose $_
|
||||
|
||||
# Filter for lines that contain a percentage that is greater than the previous one
|
||||
if (
|
||||
(
|
||||
[int]$percent = try {(
|
||||
(
|
||||
$_.Substring(
|
||||
$_.IndexOf("n") + 2,
|
||||
$_.IndexOf("%") - $_.IndexOf("n") - 2
|
||||
).ToCharArray() | Where-Object {$_}
|
||||
) -join ''
|
||||
).TrimStart()} catch {0}
|
||||
) -and $percent -gt $oldpercent
|
||||
) {
|
||||
# Update the progress bar
|
||||
$oldpercent = $percent
|
||||
Write-Progress -Id 1 -ParentId 0 -Activity "Scanning for corruption" -Status "Running SFC... ($percent%)" -PercentComplete $percent
|
||||
}
|
||||
}
|
||||
Write-Progress -Id 1 -ParentId 0 -Activity "Scanning for corruption" -Status "Completed" -PercentComplete 100
|
||||
Invoke-WPFSystemRepair
|
||||
}
|
||||
|
||||
|
||||
@ -187,9 +78,9 @@ function Invoke-WPFFixesUpdate {
|
||||
# Reset the Security Descriptors on the Windows Update Services
|
||||
Write-Progress -Id 0 -Activity "Repairing Windows Update" -Status "Resetting the WU Service Security Descriptors..." -PercentComplete 25
|
||||
Write-Progress -Id 4 -ParentId 0 -Activity "Resetting the WU Service Security Descriptors" -Status "Resetting the BITS Security Descriptor..." -PercentComplete 0
|
||||
Start-Process -NoNewWindow -FilePath "sc.exe" -ArgumentList "sdset", "bits", "D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)"
|
||||
Start-Process -NoNewWindow -FilePath "sc.exe" -ArgumentList "sdset", "bits", "D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)" -Wait
|
||||
Write-Progress -Id 4 -ParentId 0 -Activity "Resetting the WU Service Security Descriptors" -Status "Resetting the wuauserv Security Descriptor..." -PercentComplete 50
|
||||
Start-Process -NoNewWindow -FilePath "sc.exe" -ArgumentList "sdset", "wuauserv", "D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)"
|
||||
Start-Process -NoNewWindow -FilePath "sc.exe" -ArgumentList "sdset", "wuauserv", "D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)" -Wait
|
||||
Write-Progress -Id 4 -ParentId 0 -Activity "Resetting the WU Service Security Descriptors" -Status "Completed" -PercentComplete 100
|
||||
}
|
||||
|
||||
@ -221,19 +112,53 @@ function Invoke-WPFFixesUpdate {
|
||||
if (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate") {
|
||||
Write-Progress -Id 0 -Activity "Repairing Windows Update" -Status "Removing WSUS client settings..." -PercentComplete 60
|
||||
Write-Progress -Id 6 -ParentId 0 -Activity "Removing WSUS client settings" -PercentComplete 0
|
||||
Start-Process -NoNewWindow -FilePath "REG" -ArgumentList "DELETE", "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate", "/v", "AccountDomainSid", "/f" -RedirectStandardError $true
|
||||
Start-Process -NoNewWindow -FilePath "REG" -ArgumentList "DELETE", "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate", "/v", "PingID", "/f" -RedirectStandardError $true
|
||||
Start-Process -NoNewWindow -FilePath "REG" -ArgumentList "DELETE", "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate", "/v", "SusClientId", "/f" -RedirectStandardError $true
|
||||
Start-Process -NoNewWindow -FilePath "REG" -ArgumentList "DELETE", "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate", "/v", "AccountDomainSid", "/f" -RedirectStandardError "NUL"
|
||||
Start-Process -NoNewWindow -FilePath "REG" -ArgumentList "DELETE", "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate", "/v", "PingID", "/f" -RedirectStandardError "NUL"
|
||||
Start-Process -NoNewWindow -FilePath "REG" -ArgumentList "DELETE", "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate", "/v", "SusClientId", "/f" -RedirectStandardError "NUL"
|
||||
Write-Progress -Id 6 -ParentId 0 -Activity "Removing WSUS client settings" -Status "Completed" -PercentComplete 100
|
||||
}
|
||||
|
||||
# Remove Group Policy Windows Update settings
|
||||
Write-Progress -Id 0 -Activity "Repairing Windows Update" -Status "Removing Group Policy Windows Update settings..." -PercentComplete 60
|
||||
Write-Progress -Id 7 -ParentId 0 -Activity "Removing Group Policy Windows Update settings" -PercentComplete 0
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ExcludeWUDriversInQualityUpdate" -ErrorAction SilentlyContinue
|
||||
Write-Host "Defaulting driver offering through Windows Update..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Device Metadata" -Name "PreventDeviceMetadataFromNetwork" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "DontPromptForWindowsUpdate" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "DontSearchWindowsUpdate" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "DriverUpdateWizardWuSearchEnabled" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ExcludeWUDriversInQualityUpdate" -ErrorAction SilentlyContinue
|
||||
Write-Host "Defaulting Windows Update automatic restart..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoRebootWithLoggedOnUsers" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUPowerManagement" -ErrorAction SilentlyContinue
|
||||
Write-Host "Clearing ANY Windows Update Policy settings..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "BranchReadinessLevel" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "DeferFeatureUpdatesPeriodInDays" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "DeferQualityUpdatesPeriodInDays" -ErrorAction SilentlyContinue
|
||||
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
|
||||
Start-Process -NoNewWindow -FilePath "secedit" -ArgumentList "/configure", "/cfg", "$env:windir\inf\defltbase.inf", "/db", "defltbase.sdb", "/verbose" -Wait
|
||||
Start-Process -NoNewWindow -FilePath "cmd.exe" -ArgumentList "/c RD /S /Q $env:WinDir\System32\GroupPolicyUsers" -Wait
|
||||
Start-Process -NoNewWindow -FilePath "cmd.exe" -ArgumentList "/c RD /S /Q $env:WinDir\System32\GroupPolicy" -Wait
|
||||
Start-Process -NoNewWindow -FilePath "gpupdate" -ArgumentList "/force" -Wait
|
||||
Write-Progress -Id 7 -ParentId 0 -Activity "Removing Group Policy Windows Update settings" -Status "Completed" -PercentComplete 100
|
||||
|
||||
|
||||
# Reset WinSock
|
||||
Write-Progress -Id 0 -Activity "Repairing Windows Update" -Status "Resetting WinSock..." -PercentComplete 65
|
||||
Write-Progress -Id 7 -ParentId 0 -Activity "Resetting WinSock" -Status "Resetting WinSock..." -PercentComplete 0
|
||||
Start-Process -NoNewWindow -FilePath "netsh" -ArgumentList "winsock", "reset" -RedirectStandardOutput $true
|
||||
Start-Process -NoNewWindow -FilePath "netsh" -ArgumentList "winhttp", "reset", "proxy" -RedirectStandardOutput $true
|
||||
Start-Process -NoNewWindow -FilePath "netsh" -ArgumentList "int", "ip", "reset" -RedirectStandardOutput $true
|
||||
Start-Process -NoNewWindow -FilePath "netsh" -ArgumentList "winsock", "reset"
|
||||
Start-Process -NoNewWindow -FilePath "netsh" -ArgumentList "winhttp", "reset", "proxy"
|
||||
Start-Process -NoNewWindow -FilePath "netsh" -ArgumentList "int", "ip", "reset"
|
||||
Write-Progress -Id 7 -ParentId 0 -Activity "Resetting WinSock" -Status "Completed" -PercentComplete 100
|
||||
|
||||
|
||||
@ -262,7 +187,11 @@ function Invoke-WPFFixesUpdate {
|
||||
# Force Windows Update to check for updates
|
||||
Write-Progress -Id 0 -Activity "Repairing Windows Update" -Status "Forcing discovery..." -PercentComplete 95
|
||||
Write-Progress -Id 10 -ParentId 0 -Activity "Forcing discovery" -Status "Forcing discovery..." -PercentComplete 0
|
||||
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
|
||||
try {
|
||||
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
|
||||
} catch {
|
||||
Write-Warning "Failed to create Windows Update COM object: $_"
|
||||
}
|
||||
Start-Process -NoNewWindow -FilePath "wuauclt" -ArgumentList "/resetauthorization", "/detectnow"
|
||||
Write-Progress -Id 10 -ParentId 0 -Activity "Forcing discovery" -Status "Completed" -PercentComplete 100
|
||||
Write-Progress -Id 0 -Activity "Repairing Windows Update" -Status "Completed" -PercentComplete 100
|
||||
@ -284,7 +213,7 @@ function Invoke-WPFFixesUpdate {
|
||||
Write-Progress -Id 3 -Activity "Renaming/Removing Files" -Completed
|
||||
Write-Progress -Id 4 -Activity "Resetting the WU Service Security Descriptors" -Completed
|
||||
Write-Progress -Id 5 -Activity "Reregistering DLLs" -Completed
|
||||
Write-Progress -Id 6 -Activity "Removing WSUS client settings" -Completed
|
||||
Write-Progress -Id 6 -Activity "Removing Group Policy Windows Update settings" -Completed
|
||||
Write-Progress -Id 7 -Activity "Resetting WinSock" -Completed
|
||||
Write-Progress -Id 8 -Activity "Deleting BITS jobs" -Completed
|
||||
Write-Progress -Id 9 -Activity "Starting Windows Update Services" -Completed
|
||||
|
@ -1,36 +0,0 @@
|
||||
Function Invoke-WPFFormVariables {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Prints the logo
|
||||
|
||||
#>
|
||||
#If ($global:ReadmeDisplay -ne $true) { Write-Host "If you need to reference this display again, run Get-FormVariables" -ForegroundColor Yellow; $global:ReadmeDisplay = $true }
|
||||
|
||||
|
||||
Write-Host ""
|
||||
Write-Host " CCCCCCCCCCCCCTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT "
|
||||
Write-Host " CCC::::::::::::CT:::::::::::::::::::::TT:::::::::::::::::::::T "
|
||||
Write-Host "CC:::::::::::::::CT:::::::::::::::::::::TT:::::::::::::::::::::T "
|
||||
Write-Host "C:::::CCCCCCCC::::CT:::::TT:::::::TT:::::TT:::::TT:::::::TT:::::T "
|
||||
Write-Host "C:::::C CCCCCCTTTTTT T:::::T TTTTTTTTTTTT T:::::T TTTTTT"
|
||||
Write-Host "C:::::C T:::::T T:::::T "
|
||||
Write-Host "C:::::C T:::::T T:::::T "
|
||||
Write-Host "C:::::C T:::::T T:::::T "
|
||||
Write-Host "C:::::C T:::::T T:::::T "
|
||||
Write-Host "C:::::C T:::::T T:::::T "
|
||||
Write-Host "C:::::C T:::::T T:::::T "
|
||||
Write-Host "C:::::C CCCCCC T:::::T T:::::T "
|
||||
Write-Host "C:::::CCCCCCCC::::C TT:::::::TT TT:::::::TT "
|
||||
Write-Host "CC:::::::::::::::C T:::::::::T T:::::::::T "
|
||||
Write-Host "CCC::::::::::::C T:::::::::T T:::::::::T "
|
||||
Write-Host " CCCCCCCCCCCCC TTTTTTTTTTT TTTTTTTTTTT "
|
||||
Write-Host ""
|
||||
Write-Host "====Chris Titus Tech====="
|
||||
Write-Host "=====Windows Toolbox====="
|
||||
|
||||
#====DEBUG GUI Elements====
|
||||
|
||||
#Write-Host "Found the following interactable elements from our form" -ForegroundColor Cyan
|
||||
#get-variable WPF*
|
||||
}
|
@ -9,38 +9,39 @@ function Invoke-WPFGetInstalled {
|
||||
|
||||
#>
|
||||
param($checkbox)
|
||||
|
||||
if($sync.ProcessRunning) {
|
||||
if ($sync.ProcessRunning) {
|
||||
$msg = "[Invoke-WPFGetInstalled] Install process is currently running."
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
|
||||
if(($sync.WPFpreferChocolatey.IsChecked -eq $false) -and ((Test-WinUtilPackageManager -winget) -eq "not-installed") -and $checkbox -eq "winget") {
|
||||
if (($sync.ChocoRadioButton.IsChecked -eq $false) -and ((Test-WinUtilPackageManager -winget) -eq "not-installed") -and $checkbox -eq "winget") {
|
||||
return
|
||||
}
|
||||
$preferChoco = $sync.WPFpreferChocolatey.IsChecked
|
||||
Invoke-WPFRunspace -ArgumentList $checkbox, $preferChoco -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($checkbox, $preferChoco, $DebugPreference)
|
||||
$managerPreference = $sync["ManagerPreference"]
|
||||
|
||||
Invoke-WPFRunspace -ParameterList @(("managerPreference", $managerPreference),("checkbox", $checkbox)) -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param (
|
||||
[string]$checkbox,
|
||||
[PackageManagers]$managerPreference
|
||||
)
|
||||
$sync.ProcessRunning = $true
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" })
|
||||
$sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state "Indeterminate" })
|
||||
|
||||
if($checkbox -eq "winget") {
|
||||
if ($checkbox -eq "winget") {
|
||||
Write-Host "Getting Installed Programs..."
|
||||
switch ($managerPreference) {
|
||||
"Choco"{$Checkboxes = Invoke-WinUtilCurrentSystem -CheckBox "choco"; break}
|
||||
"Winget"{$Checkboxes = Invoke-WinUtilCurrentSystem -CheckBox $checkbox; break}
|
||||
}
|
||||
}
|
||||
if($checkbox -eq "tweaks") {
|
||||
elseif ($checkbox -eq "tweaks") {
|
||||
Write-Host "Getting Installed Tweaks..."
|
||||
}
|
||||
if ($preferChoco -and $checkbox -eq "winget") {
|
||||
$Checkboxes = Invoke-WinUtilCurrentSystem -CheckBox "choco"
|
||||
}
|
||||
else{
|
||||
$Checkboxes = Invoke-WinUtilCurrentSystem -CheckBox $checkbox
|
||||
}
|
||||
|
||||
$sync.form.Dispatcher.invoke({
|
||||
foreach($checkbox in $Checkboxes) {
|
||||
foreach ($checkbox in $Checkboxes) {
|
||||
$sync.$checkbox.ischecked = $True
|
||||
}
|
||||
})
|
||||
|
@ -19,45 +19,59 @@ function Invoke-WPFImpex {
|
||||
$Config = $null
|
||||
)
|
||||
|
||||
if ($type -eq "export") {
|
||||
$FileBrowser = New-Object System.Windows.Forms.SaveFileDialog
|
||||
}
|
||||
if ($type -eq "import") {
|
||||
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog
|
||||
}
|
||||
function ConfigDialog {
|
||||
if (!$Config) {
|
||||
switch ($type) {
|
||||
"export" { $FileBrowser = New-Object System.Windows.Forms.SaveFileDialog }
|
||||
"import" { $FileBrowser = New-Object System.Windows.Forms.OpenFileDialog }
|
||||
}
|
||||
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
||||
$FileBrowser.Filter = "JSON Files (*.json)|*.json"
|
||||
$FileBrowser.ShowDialog() | Out-Null
|
||||
|
||||
if (-not $Config) {
|
||||
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
||||
$FileBrowser.Filter = "JSON Files (*.json)|*.json"
|
||||
$FileBrowser.ShowDialog() | Out-Null
|
||||
|
||||
if($FileBrowser.FileName -eq "") {
|
||||
return
|
||||
if ($FileBrowser.FileName -eq "") {
|
||||
return $null
|
||||
} else {
|
||||
return $FileBrowser.FileName
|
||||
}
|
||||
} else {
|
||||
$Config = $FileBrowser.FileName
|
||||
return $Config
|
||||
}
|
||||
}
|
||||
|
||||
if ($type -eq "export") {
|
||||
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false
|
||||
$jsonFile | ConvertTo-Json | Out-File $FileBrowser.FileName -Force
|
||||
$runscript = "iex ""& { `$(irm christitus.com/win) } -Config '$($FileBrowser.FileName)'"""
|
||||
$runscript | Set-Clipboard
|
||||
}
|
||||
if ($type -eq "import") {
|
||||
$jsonFile = Get-Content $Config | ConvertFrom-Json
|
||||
|
||||
$flattenedJson = @()
|
||||
$jsonFile.PSObject.Properties | ForEach-Object {
|
||||
$category = $_.Name
|
||||
foreach ($checkboxName in $_.Value) {
|
||||
if ($category -ne "Install") {
|
||||
$flattenedJson += $checkboxName
|
||||
switch ($type) {
|
||||
"export" {
|
||||
try {
|
||||
$Config = ConfigDialog
|
||||
if ($Config) {
|
||||
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false | ConvertTo-Json
|
||||
$jsonFile | Out-File $Config -Force
|
||||
"iex ""& { `$(irm https://christitus.com/win) } -Config '$Config'""" | Set-Clipboard
|
||||
}
|
||||
} catch {
|
||||
Write-Error "An error occurred while exporting: $_"
|
||||
}
|
||||
}
|
||||
"import" {
|
||||
try {
|
||||
$Config = ConfigDialog
|
||||
if ($Config) {
|
||||
try {
|
||||
if ($Config -match '^https?://') {
|
||||
$jsonFile = (Invoke-WebRequest "$Config").Content | ConvertFrom-Json
|
||||
} else {
|
||||
$jsonFile = Get-Content $Config | ConvertFrom-Json
|
||||
}
|
||||
} catch {
|
||||
Write-Error "Failed to load the JSON file from the specified path or URL: $_"
|
||||
return
|
||||
}
|
||||
$flattenedJson = $jsonFile.PSObject.Properties.Where({ $_.Name -ne "Install" }).ForEach({ $_.Value })
|
||||
Invoke-WPFPresets -preset $flattenedJson -imported $true
|
||||
}
|
||||
} catch {
|
||||
Write-Error "An error occurred while importing: $_"
|
||||
}
|
||||
}
|
||||
|
||||
$flattenedJson = [string]$flattenedJson
|
||||
Invoke-WPFPresets -preset $flattenedJson -imported $true
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,8 @@
|
||||
function Invoke-WPFInstall {
|
||||
param (
|
||||
[Parameter(Mandatory=$false)]
|
||||
[PSObject[]]$PackagesToInstall = $($sync.selectedApps | Foreach-Object { $sync.configs.applicationsHashtable.$_ })
|
||||
)
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
@ -12,51 +16,24 @@ function Invoke-WPFInstall {
|
||||
return
|
||||
}
|
||||
|
||||
$PackagesToInstall = (Get-WinUtilCheckBoxes)["Install"]
|
||||
Write-Host $PackagesToInstall
|
||||
if ($PackagesToInstall.Count -eq 0) {
|
||||
$WarningMsg = "Please select the program(s) to install or upgrade"
|
||||
[System.Windows.MessageBox]::Show($WarningMsg, $AppTitle, [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
$ChocoPreference = $($sync.WPFpreferChocolatey.IsChecked)
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall,$ChocoPreference -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $ChocoPreference, $DebugPreference)
|
||||
if ($PackagesToInstall.count -eq 1) {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
} else {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
|
||||
}
|
||||
$packagesWinget, $packagesChoco = {
|
||||
$packagesWinget = [System.Collections.ArrayList]::new()
|
||||
$packagesChoco = [System.Collections.ArrayList]::new()
|
||||
|
||||
foreach ($package in $PackagesToInstall) {
|
||||
if ($ChocoPreference) {
|
||||
if ($package.choco -eq "na") {
|
||||
$packagesWinget.add($package.winget)
|
||||
Write-Host "Queueing $($package.winget) for Winget install"
|
||||
} else {
|
||||
$null = $packagesChoco.add($package.choco)
|
||||
Write-Host "Queueing $($package.choco) for Chocolatey install"
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($package.winget -eq "na") {
|
||||
$packagesChoco.add($package.choco)
|
||||
Write-Host "Queueing $($package.choco) for Chocolatey install"
|
||||
} else {
|
||||
$null = $packagesWinget.add($($package.winget))
|
||||
Write-Host "Queueing $($package.winget) for Winget install"
|
||||
}
|
||||
}
|
||||
}
|
||||
return $packagesWinget, $packagesChoco
|
||||
}.Invoke($PackagesToInstall)
|
||||
$ManagerPreference = $sync["ManagerPreference"]
|
||||
|
||||
Invoke-WPFRunspace -ParameterList @(("PackagesToInstall", $PackagesToInstall),("ManagerPreference", $ManagerPreference)) -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $ManagerPreference, $DebugPreference)
|
||||
|
||||
$packagesSorted = Get-WinUtilSelectedPackages -PackageList $PackagesToInstall -Preference $ManagerPreference
|
||||
|
||||
$packagesWinget = $packagesSorted[[PackageManagers]::Winget]
|
||||
$packagesChoco = $packagesSorted[[PackageManagers]::Choco]
|
||||
|
||||
try {
|
||||
$sync.ProcessRunning = $true
|
||||
$errorPackages = @()
|
||||
if($packagesWinget.Count -gt 0) {
|
||||
Install-WinUtilWinget
|
||||
Install-WinUtilProgramWinget -Action Install -Programs $packagesWinget
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user