diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md
similarity index 100%
rename from CONTRIBUTING.md
rename to .github/CONTRIBUTING.md
diff --git a/LICENSE b/.github/LICENSE
similarity index 100%
rename from LICENSE
rename to .github/LICENSE
diff --git a/.github/SECURITY.md b/.github/SECURITY.md
new file mode 100644
index 00000000..6b437033
--- /dev/null
+++ b/.github/SECURITY.md
@@ -0,0 +1,5 @@
+# Security Policy
+
+If you find a security issue please make post it in the issues tab. If you think it should be private you can email me at contact@christitus.com.
+
+For immediate response check out our discord server @ [![](https://dcbadge.limes.pink/api/server/https://discord.gg/RUbZUZyByQ?theme=default-inverted&style=for-the-badge)](https://discord.gg/RUbZUZyByQ)
diff --git a/mkdocs.yml b/.github/mkdocs.yml
similarity index 97%
rename from mkdocs.yml
rename to .github/mkdocs.yml
index 5569666e..a4c7dfe2 100644
--- a/mkdocs.yml
+++ b/.github/mkdocs.yml
@@ -1,4 +1,5 @@
site_name: WinUtil Documentation
+docs_dir: '../docs'
repo_url: https://github.com/ChrisTitusTech/winutil
nav:
@@ -12,7 +13,7 @@ nav:
theme:
name: material
- custom_dir: 'overrides'
+ custom_dir: '../overrides'
features:
- navigation.tabs
- navigation.sections
diff --git a/requirements.txt b/.github/requirements.txt
similarity index 100%
rename from requirements.txt
rename to .github/requirements.txt
diff --git a/.github/workflows/close-discussion-on-pr.yaml b/.github/workflows/close-discussion-on-pr.yaml
index 7ed0cc07..5ffeec42 100644
--- a/.github/workflows/close-discussion-on-pr.yaml
+++ b/.github/workflows/close-discussion-on-pr.yaml
@@ -35,7 +35,7 @@ jobs:
-H "Accept: application/vnd.github.v3+json" \
-d '{"state": "closed"}' \
"https://api.github.com/repos/${{ github.repository }}/discussions/$discussion_id")
-
+
if echo "$response" | jq -e '.id' > /dev/null; then
echo "Successfully closed discussion #$discussion_id"
else
@@ -45,4 +45,4 @@ jobs:
fi
done
shell: bash
- continue-on-error: true
\ No newline at end of file
+ continue-on-error: true
diff --git a/.github/workflows/compile-check.yaml b/.github/workflows/compile-check.yaml
index ff2d2fa1..394e558e 100644
--- a/.github/workflows/compile-check.yaml
+++ b/.github/workflows/compile-check.yaml
@@ -19,4 +19,4 @@ jobs:
shell: pwsh
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force; ./Compile.ps1
- continue-on-error: false # Directly fail the job on error, removing the need for a separate check
\ No newline at end of file
+ continue-on-error: false # Directly fail the job on error, removing the need for a separate check
diff --git a/.github/workflows/github-pages.yaml b/.github/workflows/github-pages.yaml
index f7d90060..b51697b8 100644
--- a/.github/workflows/github-pages.yaml
+++ b/.github/workflows/github-pages.yaml
@@ -24,8 +24,8 @@ jobs:
python-version: 3.x # Install latest Stable release of Python 3
cache: 'pip' # caching pip dependencies
- - name: Install Necessary Dependencies using 'pip install -r requirements.txt'
- run: pip install -r requirements.txt
+ - name: Install Necessary Dependencies using 'pip install -r .github/requirements.txt'
+ run: pip install -r .github/requirements.txt
- name: Build & Deploy using 'mkdocs'
- run: mkdocs gh-deploy --force
+ run: mkdocs gh-deploy --force -f .github/mkdocs.yml
\ No newline at end of file
diff --git a/.github/workflows/pre-release.yaml b/.github/workflows/pre-release.yaml
index 75f69e2f..d6bf6912 100644
--- a/.github/workflows/pre-release.yaml
+++ b/.github/workflows/pre-release.yaml
@@ -67,13 +67,13 @@ jobs:
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: Create and Upload Release
id: create_release
uses: softprops/action-gh-release@v2
diff --git a/.github/workflows/remove-winutil.yaml b/.github/workflows/remove-winutil.yaml
index 69396a3e..5dedbe93 100644
--- a/.github/workflows/remove-winutil.yaml
+++ b/.github/workflows/remove-winutil.yaml
@@ -31,4 +31,4 @@ jobs:
git commit -m "Delete winutil.ps1 as it is not allowed"
git push origin HEAD:${{ github.ref }}
env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/README.md b/README.md
index 82549f10..942a03d1 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,7 @@ If you have Issues, refer to [Known Issues](https://christitustech.github.io/win
These are the sponsors that help keep this project alive with monthly contributions.
-
+
## 🏅 Thanks to all Contributors
Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻.
diff --git a/config/autounattend.xml b/config/autounattend.xml
new file mode 100644
index 00000000..c3a2f213
--- /dev/null
+++ b/config/autounattend.xml
@@ -0,0 +1,442 @@
+
+
+
+
+
+
+
+ en-US
+
+ 0409:00000409
+ en-US
+ en-US
+ en-US
+
+
+
+
+ VK7JG-NPHTM-C97JM-9MPGT-3V66T
+
+ true
+
+
+
+ 1
+ reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassTPMCheck /t REG_DWORD /d 1 /f
+
+
+ 2
+ reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassSecureBootCheck /t REG_DWORD /d 1 /f
+
+
+ 3
+ reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassRAMCheck /t REG_DWORD /d 1 /f
+
+
+
+
+
+
+
+
+
+ 1
+ reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v BypassNRO /t REG_DWORD /d 1 /f
+
+
+ 2
+ reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"
+
+
+ 3
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Runonce" /v "UninstallCopilot" /t REG_SZ /d "powershell.exe -NoProfile -Command \"Get-AppxPackage -Name 'Microsoft.Windows.Ai.Copilot.Provider' | Remove-AppxPackage;\"" /f
+
+
+ 4
+ reg.exe add "HKU\DefaultUser\Software\Policies\Microsoft\Windows\WindowsCopilot" /v TurnOffWindowsCopilot /t REG_DWORD /d 1 /f
+
+
+ 5
+ reg.exe unload "HKU\DefaultUser"
+
+
+ 6
+ reg.exe delete "HKLM\SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate" /f
+
+
+ 7
+ reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"
+
+
+ 8
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Notepad" /v ShowStoreBanner /t REG_DWORD /d 0 /f
+
+
+ 9
+ reg.exe unload "HKU\DefaultUser"
+
+
+ 10
+ cmd.exe /c "del "C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk""
+
+
+ 11
+ cmd.exe /c "del "C:\Windows\System32\OneDriveSetup.exe""
+
+
+ 12
+ cmd.exe /c "del "C:\Windows\SysWOW64\OneDriveSetup.exe""
+
+
+ 13
+ reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"
+
+
+ 14
+ reg.exe delete "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /f
+
+
+ 15
+ reg.exe unload "HKU\DefaultUser"
+
+
+ 16
+ reg.exe delete "HKLM\SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate" /f
+
+
+ 17
+ reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v ConfigureChatAutoInstall /t REG_DWORD /d 0 /f
+
+
+ 18
+ powershell.exe -NoProfile -Command "$xml = [xml]::new(); $xml.Load('C:\Windows\Panther\unattend.xml'); $sb = [scriptblock]::Create( $xml.unattend.Extensions.ExtractScript ); Invoke-Command -ScriptBlock $sb -ArgumentList $xml;"
+
+
+ 19
+ powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\remove-packages.ps1' -Raw | Invoke-Expression;"
+
+
+ 20
+ powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\remove-caps.ps1' -Raw | Invoke-Expression;"
+
+
+ 21
+ reg.exe add "HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v ConfigureStartPins /t REG_SZ /d "{ \"pinnedList\": [] }" /f
+
+
+ 22
+ reg.exe add "HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v ConfigureStartPins_ProviderSet /t REG_DWORD /d 1 /f
+
+
+ 23
+ reg.exe add "HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v ConfigureStartPins_WinningProvider /t REG_SZ /d B5292708-1619-419B-9923-E5D9F3925E71 /f
+
+
+ 24
+ reg.exe add "HKLM\SOFTWARE\Microsoft\PolicyManager\providers\B5292708-1619-419B-9923-E5D9F3925E71\default\Device\Start" /v ConfigureStartPins /t REG_SZ /d "{ \"pinnedList\": [] }" /f
+
+
+ 25
+ 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
+
+
+ 26
+ net.exe accounts /maxpwage:UNLIMITED
+
+
+ 27
+ reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
+
+
+ 28
+ reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f
+
+
+ 29
+ reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /f
+
+
+ 30
+ reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"
+
+
+ 31
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "ContentDeliveryAllowed" /t REG_DWORD /d 0 /f
+
+
+ 32
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "FeatureManagementEnabled" /t REG_DWORD /d 0 /f
+
+
+ 33
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "OEMPreInstalledAppsEnabled" /t REG_DWORD /d 0 /f
+
+
+ 34
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEnabled" /t REG_DWORD /d 0 /f
+
+
+ 35
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEverEnabled" /t REG_DWORD /d 0 /f
+
+
+ 36
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SilentInstalledAppsEnabled" /t REG_DWORD /d 0 /f
+
+
+ 37
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SoftLandingEnabled" /t REG_DWORD /d 0 /f
+
+
+ 38
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContentEnabled" /t REG_DWORD /d 0 /f
+
+
+ 39
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-310093Enabled" /t REG_DWORD /d 0 /f
+
+
+ 40
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338387Enabled" /t REG_DWORD /d 0 /f
+
+
+ 41
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338388Enabled" /t REG_DWORD /d 0 /f
+
+
+ 42
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338389Enabled" /t REG_DWORD /d 0 /f
+
+
+ 43
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338393Enabled" /t REG_DWORD /d 0 /f
+
+
+ 44
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-353698Enabled" /t REG_DWORD /d 0 /f
+
+
+ 45
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SystemPaneSuggestionsEnabled" /t REG_DWORD /d 0 /f
+
+
+ 46
+ reg.exe unload "HKU\DefaultUser"
+
+
+ 47
+ reg.exe add "HKLM\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d 0 /f
+
+
+ 48
+ reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\BitLocker" /v "PreventDeviceEncryption" /t REG_DWORD /d 1 /f
+
+
+ 49
+ reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"
+
+
+ 50
+ 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
+
+
+ 51
+ reg.exe unload "HKU\DefaultUser"
+
+
+
+
+
+
+
+
+ 0409:00000409
+ en-US
+ en-US
+ en-US
+
+
+
+
+
+ User
+ Administrators
+
+
+ true
+
+
+
+
+
+ User
+ true
+ 1
+
+
+ true
+
+
+
+ 3
+ true
+ true
+
+
+
+ 1
+ reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoLogonCount /t REG_DWORD /d 0 /f
+
+
+
+
+
+
+param(
+ [xml] $Document
+);
+
+$scriptsDir = 'C:\Windows\Setup\Scripts\';
+foreach( $file in $Document.unattend.Extensions.File ) {
+ $path = [System.Environment]::ExpandEnvironmentVariables(
+ $file.GetAttribute( 'path' )
+ );
+ if( $path.StartsWith( $scriptsDir ) ) {
+ mkdir -Path $scriptsDir -ErrorAction 'SilentlyContinue';
+ }
+ $encoding = switch( [System.IO.Path]::GetExtension( $path ) ) {
+ { $_ -in '.ps1', '.xml' } { [System.Text.Encoding]::UTF8; }
+ { $_ -in '.reg', '.vbs', '.js' } { [System.Text.UnicodeEncoding]::new( $false, $true ); }
+ default { [System.Text.Encoding]::Default; }
+ };
+ [System.IO.File]::WriteAllBytes( $path, ( $encoding.GetPreamble() + $encoding.GetBytes( $file.InnerText.Trim() ) ) );
+}
+
+
+$selectors = @(
+ 'Microsoft.Microsoft3DViewer';
+ 'Microsoft.BingSearch';
+ 'Microsoft.WindowsCamera';
+ 'Clipchamp.Clipchamp';
+ 'Microsoft.WindowsAlarms';
+ 'Microsoft.549981C3F5F10';
+ 'Microsoft.Windows.DevHome';
+ 'MicrosoftCorporationII.MicrosoftFamily';
+ 'Microsoft.WindowsFeedbackHub';
+ 'Microsoft.GetHelp';
+ 'Microsoft.Getstarted';
+ 'microsoft.windowscommunicationsapps';
+ 'Microsoft.WindowsMaps';
+ 'Microsoft.BingNews';
+ 'Microsoft.WindowsNotepad';
+ 'Microsoft.MicrosoftOfficeHub';
+ 'Microsoft.Office.OneNote';
+ 'Microsoft.OutlookForWindows';
+ 'Microsoft.MSPaint';
+ 'Microsoft.People';
+ 'Microsoft.PowerAutomateDesktop';
+ 'MicrosoftCorporationII.QuickAssist';
+ 'Microsoft.SkypeApp';
+ 'Microsoft.MicrosoftSolitaireCollection';
+ 'Microsoft.MicrosoftStickyNotes';
+ 'MSTeams';
+ 'Microsoft.Todos';
+ 'Microsoft.WindowsSoundRecorder';
+ 'Microsoft.BingWeather';
+ 'Microsoft.ZuneMusic';
+ 'Microsoft.ZuneVideo';
+);
+$getCommand = { Get-AppxProvisionedPackage -Online; };
+$filterCommand = { $_.DisplayName -eq $selector; };
+$removeCommand = {
+ [CmdletBinding()]
+ param(
+ [Parameter( Mandatory, ValueFromPipeline )]
+ $InputObject
+ );
+ process {
+ $InputObject | Remove-AppxProvisionedPackage -AllUsers -Online -ErrorAction 'Continue';
+ }
+};
+$type = 'Package';
+$logfile = 'C:\Windows\Temp\remove-packages.log';
+& {
+ $installed = & $getCommand;
+ foreach( $selector in $selectors ) {
+ $result = [ordered] @{
+ Selector = $selector;
+ };
+ $found = $installed | Where-Object -FilterScript $filterCommand;
+ if( $found ) {
+ $result.Output = $found | & $removeCommand;
+ if( $? ) {
+ $result.Message = "$type removed.";
+ } else {
+ $result.Message = "$type not removed.";
+ $result.Error = $Error[0];
+ }
+ } else {
+ $result.Message = "$type not installed.";
+ }
+ $result | ConvertTo-Json -Depth 3 -Compress;
+ }
+} *>&1 >> $logfile;
+
+
+$selectors = @(
+ 'Browser.InternetExplorer';
+ 'MathRecognizer';
+ 'OpenSSH.Client';
+ 'App.Support.QuickAssist';
+ 'App.StepsRecorder';
+ 'Media.WindowsMediaPlayer';
+ 'Microsoft.Windows.WordPad';
+);
+$getCommand = { Get-WindowsCapability -Online; };
+$filterCommand = { ($_.Name -split '~')[0] -eq $selector; };
+$removeCommand = {
+ [CmdletBinding()]
+ param(
+ [Parameter( Mandatory, ValueFromPipeline )]
+ $InputObject
+ );
+ process {
+ $InputObject | Remove-WindowsCapability -Online -ErrorAction 'Continue';
+ }
+};
+$type = 'Capability';
+$logfile = 'C:\Windows\Temp\remove-caps.log';
+& {
+ $installed = & $getCommand;
+ foreach( $selector in $selectors ) {
+ $result = [ordered] @{
+ Selector = $selector;
+ };
+ $found = $installed | Where-Object -FilterScript $filterCommand;
+ if( $found ) {
+ $result.Output = $found | & $removeCommand;
+ if( $? ) {
+ $result.Message = "$type removed.";
+ } else {
+ $result.Message = "$type not removed.";
+ $result.Error = $Error[0];
+ }
+ } else {
+ $result.Message = "$type not installed.";
+ }
+ $result | ConvertTo-Json -Depth 3 -Compress;
+ }
+} *>&1 >> $logfile;
+
+
+
+
+
+
+
+
+
+ ]]>
+
+
diff --git a/config/tweaks.json b/config/tweaks.json
index 8702322f..07c17d85 100644
--- a/config/tweaks.json
+++ b/config/tweaks.json
@@ -2561,15 +2561,10 @@
"panel": "1",
"Order": "a029_",
"InvokeScript": [
- "
- Uninstall-WinUtilEdgeBrowser
- "
+ "Uninstall-WinUtilEdgeBrowser -action \"Uninstall\""
],
"UndoScript": [
- "
- Write-Host \"Install Microsoft Edge\"
- Start-Process -FilePath winget -ArgumentList \"install --force -e --accept-source-agreements --accept-package-agreements --silent Microsoft.Edge \" -NoNewWindow -Wait
- "
+ "Uninstall-WinUtilEdgeBrowser -action \"Install\""
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveEdge"
},
diff --git a/docs/contribute.md b/docs/contribute.md
index c93fd74c..457c880c 100644
--- a/docs/contribute.md
+++ b/docs/contribute.md
@@ -1,3 +1,3 @@
---8<-- "CONTRIBUTING.md"
+--8<-- ".github/CONTRIBUTING.md"
diff --git a/functions/private/Get-WinUtilToggleStatus.ps1 b/functions/private/Get-WinUtilToggleStatus.ps1
index 019978a4..ea349779 100644
--- a/functions/private/Get-WinUtilToggleStatus.ps1
+++ b/functions/private/Get-WinUtilToggleStatus.ps1
@@ -140,8 +140,9 @@ Function Get-WinUtilToggleStatus {
}
}
if ($ToggleSwitch -eq "WPFToggleDetailedBSoD") {
- $DetailedBSoD = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisplayParameters
- if($DetailedBSoD -eq 0) {
+ $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
diff --git a/functions/private/Invoke-WinUtilDetailedBSoD.ps1 b/functions/private/Invoke-WinUtilDetailedBSoD.ps1
index 21b0a84f..efe4f624 100644
--- a/functions/private/Invoke-WinUtilDetailedBSoD.ps1
+++ b/functions/private/Invoke-WinUtilDetailedBSoD.ps1
@@ -18,6 +18,10 @@ Function Invoke-WinUtilDetailedBSoD {
}
$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"
diff --git a/functions/private/Invoke-MicroWin-Helper.ps1 b/functions/private/Invoke-WinUtilMicroWin-Helper.ps1
similarity index 50%
rename from functions/private/Invoke-MicroWin-Helper.ps1
rename to functions/private/Invoke-WinUtilMicroWin-Helper.ps1
index d0cd1c9e..3f473d85 100644
--- a/functions/private/Invoke-MicroWin-Helper.ps1
+++ b/functions/private/Invoke-WinUtilMicroWin-Helper.ps1
@@ -25,25 +25,22 @@ function Test-CompatibleImage() {
}
}
-function Remove-Features([switch]$dumpFeatures = $false, [switch]$keepDefender = $false) {
+function Remove-Features() {
<#
.SYNOPSIS
Removes certain features from ISO image
.PARAMETER Name
- dumpFeatures - Dumps all features found in the ISO into a file called allfeaturesdump.txt. This file can be examined and used to decide what to remove.
- keepDefender - Should Defender be removed from the ISO?
+ No Params
.EXAMPLE
- Remove-Features -keepDefender:$false
+ Remove-Features
#>
try {
$featlist = (Get-WindowsOptionalFeature -Path $scratchDir).FeatureName
- if ($dumpFeatures) {
- $featlist > allfeaturesdump.txt
- }
$featlist = $featlist | Where-Object {
+ $_ -NotLike "*Defender*" -AND
$_ -NotLike "*Printing*" -AND
$_ -NotLike "*TelnetClient*" -AND
$_ -NotLike "*PowerShell*" -AND
@@ -52,8 +49,6 @@ function Remove-Features([switch]$dumpFeatures = $false, [switch]$keepDefender =
$_ -NotLike "*NFS*"
}
- if ($keepDefender) { $featlist = $featlist | Where-Object { $_ -NotLike "*Defender*" }}
-
foreach($feature in $featlist) {
$status = "Removing feature $feature"
Write-Progress -Activity "Removing features" -Status $status -PercentComplete ($counter++/$featlist.Count*100)
@@ -126,46 +121,59 @@ function Remove-Packages {
}
}
-function Remove-ProvisionedPackages([switch]$keepSecurity = $false) {
+function Remove-ProvisionedPackages() {
<#
.SYNOPSIS
Removes AppX packages from a Windows image during MicroWin processing
.PARAMETER Name
- keepSecurity - Boolean that determines whether to keep "Microsoft.SecHealthUI" (Windows Security) in the Windows image
+ No Params
.EXAMPLE
- Remove-ProvisionedPackages -keepSecurity:$false
+ Remove-ProvisionedPackages
#>
- $appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object {
- $_.PackageName -NotLike "*AppInstaller*" -AND
- $_.PackageName -NotLike "*Store*" -and
- $_.PackageName -NotLike "*dism*" -and
- $_.PackageName -NotLike "*Foundation*" -and
- $_.PackageName -NotLike "*FodMetadata*" -and
- $_.PackageName -NotLike "*LanguageFeatures*" -and
- $_.PackageName -NotLike "*Notepad*" -and
- $_.PackageName -NotLike "*Printing*" -and
- $_.PackageName -NotLike "*Wifi*" -and
- $_.PackageName -NotLike "*Foundation*"
+ 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 "*Wifi*" -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*"
}
- if ($?) {
- if ($keepSecurity) { $appxProvisionedPackages = $appxProvisionedPackages | Where-Object { $_.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
+ 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
- } else {
- Write-Host "Could not get Provisioned App information. Skipping process..."
+ }
+ 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"
}
}
@@ -175,9 +183,9 @@ function Copy-ToUSB([string]$fileToCopy) {
$destinationPath = "$($volume.DriveLetter):\"
#Copy-Item -Path $fileToCopy -Destination $destinationPath -Force
# Get the total size of the file
- $totalSize = (Get-Item $fileToCopy).length
+ $totalSize = (Get-Item "$fileToCopy").length
- Copy-Item -Path $fileToCopy -Destination $destinationPath -Verbose -Force -Recurse -Container -PassThru |
+ Copy-Item -Path "$fileToCopy" -Destination "$destinationPath" -Verbose -Force -Recurse -Container -PassThru |
ForEach-Object {
# Calculate the percentage completed
$completed = ($_.BytesTransferred / $totalSize) * 100
@@ -200,22 +208,6 @@ function Remove-FileOrDirectory([string]$pathToDelete, [string]$mask = "", [swit
$yesNo = Get-LocalizedYesNo
Write-Host "[INFO] In Your local takeown expects '$($yesNo[0])' as a Yes answer."
- # Specify the path to the directory
- # $directoryPath = "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup"
- # takeown /a /r /d $yesNo[0] /f "$($directoryPath)" > $null
- # icacls "$($directoryPath)" /q /c /t /reset > $null
- # icacls $directoryPath /setowner "*S-1-5-32-544"
- # icacls $directoryPath /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
- # Remove-Item -Path $directoryPath -Recurse -Force
-
- # # Grant full control to BUILTIN\Administrators using icacls
- # $directoryPath = "$($scratchDir)\Windows\System32\WebThreatDefSvc"
- # takeown /a /r /d $yesNo[0] /f "$($directoryPath)" > $null
- # icacls "$($directoryPath)" /q /c /t /reset > $null
- # icacls $directoryPath /setowner "*S-1-5-32-544"
- # icacls $directoryPath /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
- # Remove-Item -Path $directoryPath -Recurse -Force
-
$itemsToDelete = [System.Collections.ArrayList]::new()
if ($mask -eq "") {
@@ -254,46 +246,6 @@ function Remove-FileOrDirectory([string]$pathToDelete, [string]$mask = "", [swit
function New-Unattend {
- # later if we wont to remove even more bloat EU requires MS to remove everything from English(world)
- # Below is an example how to do it we probably should create a drop down with common locals
- #
- #
- #
- #
- # en-US
- #
- # en-US
- # en-US
- # en-US
- # en-US
- #
- #
-
- #
- #
- #
- # en-US
- # en-US
- # en-US
- # en-US
- #
- #
- # using here string to embedd unattend
- #
- # 1
- # net user administrator /active:yes
- #
-
- # this section doesn't work in win10/????
-#
-#
-# 0
-#
-#
-# false
-#
-#
-
$unattend = @'
+
+
+
+ User
+ Administrators
+
+
+ true
+
+
+
+
+
+ User
+ true
+ 1
+
+
+ true
+
+
- true
- false
- false
+ true
+ true
+ true
true
true
true
@@ -325,14 +298,18 @@ function New-Unattend {
1
- cmd.exe /c echo 23>c:\windows\csup.txt
+ reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoLogonCount /t REG_DWORD /d 0 /f
2
- CMD /C echo GG>C:\Windows\LogOobeSystem.txt
+ cmd.exe /c echo 23>c:\windows\csup.txt
3
+ CMD /C echo GG>C:\Windows\LogOobeSystem.txt
+
+
+ 4
powershell -ExecutionPolicy Bypass -File c:\windows\FirstStartup.ps1
@@ -343,10 +320,218 @@ function New-Unattend {
$specPass = @'
- 0
+ 0
- false
+ false
+
+
+
+
+ 1
+ reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" /v BypassNRO /t REG_DWORD /d 1 /f
+
+
+ 2
+ reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"
+
+
+ 3
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Runonce" /v "UninstallCopilot" /t REG_SZ /d "powershell.exe -NoProfile -Command \"Get-AppxPackage -Name 'Microsoft.Windows.Ai.Copilot.Provider' | Remove-AppxPackage;\"" /f
+
+
+ 4
+ reg.exe add "HKU\DefaultUser\Software\Policies\Microsoft\Windows\WindowsCopilot" /v TurnOffWindowsCopilot /t REG_DWORD /d 1 /f
+
+
+ 5
+ reg.exe unload "HKU\DefaultUser"
+
+
+ 6
+ reg.exe delete "HKLM\SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate" /f
+
+
+ 7
+ reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"
+
+
+ 8
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Notepad" /v ShowStoreBanner /t REG_DWORD /d 0 /f
+
+
+ 9
+ reg.exe unload "HKU\DefaultUser"
+
+
+ 10
+ cmd.exe /c "del "C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk""
+
+
+ 11
+ cmd.exe /c "del "C:\Windows\System32\OneDriveSetup.exe""
+
+
+ 12
+ cmd.exe /c "del "C:\Windows\SysWOW64\OneDriveSetup.exe""
+
+
+ 13
+ reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"
+
+
+ 14
+ reg.exe delete "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /f
+
+
+ 15
+ reg.exe unload "HKU\DefaultUser"
+
+
+ 16
+ reg.exe delete "HKLM\SOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate" /f
+
+
+ 17
+ reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" /v ConfigureChatAutoInstall /t REG_DWORD /d 0 /f
+
+
+ 18
+ powershell.exe -NoProfile -Command "$xml = [xml]::new(); $xml.Load('C:\Windows\Panther\unattend.xml'); $sb = [scriptblock]::Create( $xml.unattend.Extensions.ExtractScript ); Invoke-Command -ScriptBlock $sb -ArgumentList $xml;"
+
+
+ 19
+ powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\remove-packages.ps1' -Raw | Invoke-Expression;"
+
+
+ 20
+ powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\remove-caps.ps1' -Raw | Invoke-Expression;"
+
+
+ 21
+ reg.exe add "HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v ConfigureStartPins /t REG_SZ /d "{ \"pinnedList\": [] }" /f
+
+
+ 22
+ reg.exe add "HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v ConfigureStartPins_ProviderSet /t REG_DWORD /d 1 /f
+
+
+ 23
+ reg.exe add "HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start" /v ConfigureStartPins_WinningProvider /t REG_SZ /d B5292708-1619-419B-9923-E5D9F3925E71 /f
+
+
+ 24
+ reg.exe add "HKLM\SOFTWARE\Microsoft\PolicyManager\providers\B5292708-1619-419B-9923-E5D9F3925E71\default\Device\Start" /v ConfigureStartPins /t REG_SZ /d "{ \"pinnedList\": [] }" /f
+
+
+ 25
+ 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
+
+
+ 26
+ net.exe accounts /maxpwage:UNLIMITED
+
+
+ 27
+ reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
+
+
+ 28
+ reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f
+
+
+ 29
+ reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /f
+
+
+ 30
+ reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"
+
+
+ 31
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "ContentDeliveryAllowed" /t REG_DWORD /d 0 /f
+
+
+ 32
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "FeatureManagementEnabled" /t REG_DWORD /d 0 /f
+
+
+ 33
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "OEMPreInstalledAppsEnabled" /t REG_DWORD /d 0 /f
+
+
+ 34
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEnabled" /t REG_DWORD /d 0 /f
+
+
+ 35
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "PreInstalledAppsEverEnabled" /t REG_DWORD /d 0 /f
+
+
+ 36
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SilentInstalledAppsEnabled" /t REG_DWORD /d 0 /f
+
+
+ 37
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SoftLandingEnabled" /t REG_DWORD /d 0 /f
+
+
+ 38
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContentEnabled" /t REG_DWORD /d 0 /f
+
+
+ 39
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-310093Enabled" /t REG_DWORD /d 0 /f
+
+
+ 40
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338387Enabled" /t REG_DWORD /d 0 /f
+
+
+ 41
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338388Enabled" /t REG_DWORD /d 0 /f
+
+
+ 42
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338389Enabled" /t REG_DWORD /d 0 /f
+
+
+ 43
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338393Enabled" /t REG_DWORD /d 0 /f
+
+
+ 44
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-353698Enabled" /t REG_DWORD /d 0 /f
+
+
+ 45
+ reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SystemPaneSuggestionsEnabled" /t REG_DWORD /d 0 /f
+
+
+ 46
+ reg.exe unload "HKU\DefaultUser"
+
+
+ 47
+ reg.exe add "HKLM\Software\Policies\Microsoft\Windows\CloudContent" /v "DisableWindowsConsumerFeatures" /t REG_DWORD /d 0 /f
+
+
+ 48
+ reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\BitLocker" /v "PreventDeviceEncryption" /t REG_DWORD /d 1 /f
+
+
+ 49
+ reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"
+
+
+ 50
+ 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
+
+
+ 51
+ reg.exe unload "HKU\DefaultUser"
+
+
'@
@@ -466,94 +651,8 @@ function New-FirstRun {
}
}
- function Stop-UnnecessaryServices {
- $servicesToExclude = @(
- "AudioSrv",
- "AudioEndpointBuilder",
- "BFE",
- "BITS",
- "BrokerInfrastructure",
- "CDPSvc",
- "CDPUserSvc_dc2a4",
- "CoreMessagingRegistrar",
- "CryptSvc",
- "DPS",
- "DcomLaunch",
- "Dhcp",
- "DispBrokerDesktopSvc",
- "Dnscache",
- "DoSvc",
- "DusmSvc",
- "EventLog",
- "EventSystem",
- "FontCache",
- "LSM",
- "LanmanServer",
- "LanmanWorkstation",
- "MapsBroker",
- "MpsSvc",
- "OneSyncSvc_dc2a4",
- "Power",
- "ProfSvc",
- "RpcEptMapper",
- "RpcSs",
- "SCardSvr",
- "SENS",
- "SamSs",
- "Schedule",
- "SgrmBroker",
- "ShellHWDetection",
- "Spooler",
- "SysMain",
- "SystemEventsBroker",
- "TextInputManagementService",
- "Themes",
- "TrkWks",
- "UserManager",
- "VGAuthService",
- "VMTools",
- "WSearch",
- "Wcmsvc",
- "WinDefend",
- "Winmgmt",
- "WlanSvc",
- "WpnService",
- "WpnUserService_dc2a4",
- "cbdhsvc_dc2a4",
- "edgeupdate",
- "gpsvc",
- "iphlpsvc",
- "mpssvc",
- "nsi",
- "sppsvc",
- "tiledatamodelsvc",
- "vm3dservice",
- "webthreatdefusersvc_dc2a4",
- "wscsvc"
-)
-
- $runningServices = Get-Service | Where-Object { $servicesToExclude -notcontains $_.Name }
- foreach($service in $runningServices) {
- Stop-Service -Name $service.Name -PassThru
- Set-Service $service.Name -StartupType Manual
- "Stopping service $($service.Name)" | Out-File -FilePath c:\windows\LogFirstRun.txt -Append -NoClobber
- }
- }
-
"FirstStartup has worked" | Out-File -FilePath c:\windows\LogFirstRun.txt -Append -NoClobber
- $Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
- Set-ItemProperty -Path $Theme -Name AppsUseLightTheme -Value 1
- Set-ItemProperty -Path $Theme -Name SystemUsesLightTheme -Value 1
-
- # figure this out later how to set updates to security only
- #Import-Module -Name PSWindowsUpdate;
- #Stop-Service -Name wuauserv
- #Set-WUSettings -MicrosoftUpdateEnabled -AutoUpdateOption 'Never'
- #Start-Service -Name wuauserv
-
- Stop-UnnecessaryServices
-
$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
@@ -561,14 +660,6 @@ function New-FirstRun {
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesChanges"
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "Favorites"
- # Stop-Process -Name explorer -Force
-
- $process = Get-Process -Name "explorer"
- Stop-Process -InputObject $process
- # Wait for the process to exit
- Wait-Process -InputObject $process
- Start-Sleep -Seconds 3
-
# Delete Edge Icon from the desktop
$edgeShortcutFiles = Get-ChildItem -Path $desktopPath -Filter "*Edge*.lnk"
# Check if Edge shortcuts exist on the desktop
diff --git a/functions/private/Uninstall-WinUtilEdgeBrowser.ps1 b/functions/private/Uninstall-WinUtilEdgeBrowser.ps1
index 4d004f39..f090e95f 100644
--- a/functions/private/Uninstall-WinUtilEdgeBrowser.ps1
+++ b/functions/private/Uninstall-WinUtilEdgeBrowser.ps1
@@ -6,6 +6,12 @@ Function Uninstall-WinUtilEdgeBrowser {
This will switch up the region to one of the EEA countries temporarily and uninstall the Edge Browser (Chromium).
#>
+ param (
+ [Parameter(Mandatory = $true)]
+ [ValidateSet("install", "uninstall")]
+ [string]$action
+ )
+
function Uninstall-EdgeClient {
param (
[Parameter(Mandatory = $true)]
@@ -65,6 +71,16 @@ Function Uninstall-WinUtilEdgeBrowser {
[microsoft.win32.registry]::SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdateDev", "AllowUninstall", 1, [Microsoft.Win32.RegistryValueKind]::DWord) | Out-Null
Uninstall-EdgeClient -Key '{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}'
+
+ Remove-Item -Path "Computer\\HKEY_CLASSES_ROOT\\MSEdgePDF" -ErrorAction SilentlyContinue | Out-Null
+ Remove-Item -Path "Computer\\HKEY_CLASSES_ROOT\\MSEdgeHTM" -ErrorAction SilentlyContinue | Out-Null
+ Remove-Item -Path "Computer\\HKEY_CLASSES_ROOT\\MSEdgeMHT" -ErrorAction SilentlyContinue | Out-Null
+
+ # Remove Edge Polocy reg keys
+ Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Edge" -Recurse -ErrorAction SilentlyContinue | Out-Null
+
+ # Remove Edge reg keys
+ Remove-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Edge" -Recurse -ErrorAction SilentlyContinue | Out-Null
}
function Uninstall-WebView {
@@ -93,9 +109,30 @@ Function Uninstall-WinUtilEdgeBrowser {
}
Start-Process cmd.exe "/c $uninstallCmdLine" -WindowStyle Hidden -Wait
+
+ # Remove EdgeUpdate reg keys
+ Remove-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate" -Recurse -ErrorAction SilentlyContinue | Out-Null
}
- Uninstall-Edge
- # Uninstall-WebView - WebView is needed for Visual Studio and some MS Store Games like Forza
- Uninstall-EdgeUpdate
+ function Install-Edge {
+ $tempEdgePath = "$env:TEMP\MicrosoftEdgeSetup.exe"
+
+ try {
+ write-host "Installing Edge ..."
+ Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/?linkid=2109047&Channel=Stable&language=en&consent=1" -OutFile $tempEdgePath
+ Start-Process -FilePath $tempEdgePath -ArgumentList "/silent /install" -Wait
+ Remove-item $tempEdgePath
+ write-host "Edge Installed Successfully"
+ } catch {
+ write-host "Failed to install Edge"
+ }
+ }
+
+ if ($action -eq "Install") {
+ Install-Edge
+ } elseif ($action -eq "Uninstall") {
+ Uninstall-Edge
+ Uninstall-EdgeUpdate
+ # Uninstall-WebView - WebView is needed for Visual Studio and some MS Store Games like Forza
+ }
}
diff --git a/functions/public/Invoke-WPFGetIso.ps1 b/functions/public/Invoke-WPFGetIso.ps1
index 2db534c7..9a0b7455 100644
--- a/functions/public/Invoke-WPFGetIso.ps1
+++ b/functions/public/Invoke-WPFGetIso.ps1
@@ -76,7 +76,7 @@ function Invoke-WPFGetIso {
}
Write-Host "File path $($filePath)"
- if (-not (Test-Path -Path $filePath -PathType Leaf)) {
+ if (-not (Test-Path -Path "$filePath" -PathType Leaf)) {
$msg = "File you've chosen doesn't exist"
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
return
@@ -85,7 +85,7 @@ function Invoke-WPFGetIso {
Set-WinUtilTaskbaritem -state "Indeterminate" -overlay "logo"
# Detect the file size of the ISO and compare it with the free space of the system drive
- $isoSize = (Get-Item -Path $filePath).Length
+ $isoSize = (Get-Item -Path "$filePath").Length
Write-Debug "Size of ISO file: $($isoSize) bytes"
# Use this procedure to get the free space of the drive depending on where the user profile folder is stored.
# This is done to guarantee a dynamic solution, as the installation drive may be mounted to a letter different than C
@@ -122,7 +122,7 @@ function Invoke-WPFGetIso {
# there is probably a better way of doing this, I don't have time to figure this out
$sync.MicrowinIsoDrive.Text = $driveLetter
- $mountedISOPath = (Split-Path -Path $filePath)
+ $mountedISOPath = (Split-Path -Path "$filePath")
if ($sync.MicrowinScratchDirBox.Text.Trim() -eq "Scratch") {
$sync.MicrowinScratchDirBox.Text =""
}
@@ -186,7 +186,7 @@ function Invoke-WPFGetIso {
$wimFile = "$mountDir\sources\install.wim"
Write-Host "Getting image information $wimFile"
- if ((-not (Test-Path -Path $wimFile -PathType Leaf)) -and (-not (Test-Path -Path $wimFile.Replace(".wim", ".esd").Trim() -PathType Leaf))) {
+ if ((-not (Test-Path -Path "$wimFile" -PathType Leaf)) -and (-not (Test-Path -Path "$($wimFile.Replace(".wim", ".esd").Trim())" -PathType Leaf))) {
$msg = "Neither install.wim nor install.esd exist in the image, this could happen if you use unofficial Windows images. Please don't use shady images from the internet, use only official images. Here are instructions how to download ISO images if the Microsoft website is not showing the link to download and ISO. https://www.techrepublic.com/article/how-to-download-a-windows-10-iso-file-without-using-the-media-creation-tool/"
Write-Host $msg
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
diff --git a/functions/public/Invoke-WPFMicrowin.ps1 b/functions/public/Invoke-WPFMicrowin.ps1
index 23a12fa2..9bb89194 100644
--- a/functions/public/Invoke-WPFMicrowin.ps1
+++ b/functions/public/Invoke-WPFMicrowin.ps1
@@ -63,11 +63,11 @@ public class PowerManagement {
$scratchDir = $sync.MicrowinScratchDir.Text
# Detect if the Windows image is an ESD file and convert it to WIM
- if (-not (Test-Path -Path $mountDir\sources\install.wim -PathType Leaf) -and (Test-Path -Path $mountDir\sources\install.esd -PathType Leaf)) {
+ if (-not (Test-Path -Path "$mountDir\sources\install.wim" -PathType Leaf) -and (Test-Path -Path "$mountDir\sources\install.esd" -PathType Leaf)) {
Write-Host "Exporting Windows image to a WIM file, keeping the index we want to work on. This can take several minutes, depending on the performance of your computer..."
Export-WindowsImage -SourceImagePath $mountDir\sources\install.esd -SourceIndex $index -DestinationImagePath $mountDir\sources\install.wim -CompressionType "Max"
if ($?) {
- Remove-Item -Path $mountDir\sources\install.esd -Force
+ Remove-Item -Path "$mountDir\sources\install.esd" -Force
# Since we've already exported the image index we wanted, switch to the first one
$index = 1
} else {
@@ -116,7 +116,7 @@ public class PowerManagement {
if (Test-Path "$env:TEMP\DRV_EXPORT") {
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
}
- if (($injectDrivers -and (Test-Path $sync.MicrowinDriverLocation.Text))) {
+ if (($injectDrivers -and (Test-Path "$($sync.MicrowinDriverLocation.Text)"))) {
Write-Host "Using specified driver source..."
dism /english /online /export-driver /destination="$($sync.MicrowinDriverLocation.Text)" | Out-Host
if ($?) {
@@ -151,39 +151,16 @@ public class PowerManagement {
}
Write-Host "Remove Features from the image"
- Remove-Features -keepDefender:$keepDefender
+ Remove-Features
Write-Host "Removing features complete!"
+ Write-Host "Removing OS packages"
+ Remove-Packages
+ Write-Host "Removing Appx Bloat"
+ Remove-ProvisionedPackages
- if (!$keepPackages) {
- Write-Host "Removing OS packages"
- Remove-Packages
- }
- if (!$keepProvisionedPackages) {
- Write-Host "Removing Appx Bloat"
- Remove-ProvisionedPackages -keepSecurity:$keepDefender
- }
-
- # special code, for some reason when you try to delete some inbox apps
- # we have to get and delete log files directory.
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup" -Directory
- Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\WebThreatDefSvc" -Directory
-
- # Defender is hidden in 2 places we removed a feature above now need to remove it from the disk
- if (!$keepDefender) {
- Write-Host "Removing Defender"
- Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Defender" -Directory
- Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Defender"
- }
- if (!$keepEdge) {
- Write-Host "Removing Edge"
- Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Microsoft" -mask "*edge*" -Directory
- Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Microsoft" -mask "*edge*" -Directory
- Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*edge*" -Directory
- }
-
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\DiagTrack" -Directory
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\InboxApps" -Directory
- Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\SecurityHealthSystray.exe"
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
@@ -196,9 +173,7 @@ public class PowerManagement {
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 "*Windows.Search*" -Directory
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*narratorquickstart*" -Directory
- Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*Xbox*" -Directory
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*ParentalControls*" -Directory
Write-Host "Removal complete!"
@@ -225,28 +200,6 @@ public class PowerManagement {
New-Item -ItemType Directory -Force -Path "$desktopDir"
dism /English /image:$($scratchDir) /set-profilepath:"$($scratchDir)\Windows\Users\Default"
- # $command = "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command 'irm https://christitus.com/win | iex'"
- # $shortcutPath = "$desktopDir\WinUtil.lnk"
- # $shell = New-Object -ComObject WScript.Shell
- # $shortcut = $shell.CreateShortcut($shortcutPath)
-
- # if (Test-Path -Path "$env:TEMP\cttlogo.png")
- # {
- # $pngPath = "$env:TEMP\cttlogo.png"
- # $icoPath = "$env:TEMP\cttlogo.ico"
- # ConvertTo-Icon -bitmapPath $pngPath -iconPath $icoPath
- # Write-Host "ICO file created at: $icoPath"
- # Copy-Item "$env:TEMP\cttlogo.png" "$($scratchDir)\Windows\cttlogo.png" -force
- # Copy-Item "$env:TEMP\cttlogo.ico" "$($scratchDir)\Windows\cttlogo.ico" -force
- # $shortcut.IconLocation = "c:\Windows\cttlogo.ico"
- # }
-
- # $shortcut.TargetPath = "powershell.exe"
- # $shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`""
- # $shortcut.Save()
- # Write-Host "Shortcut to winutil created at: $shortcutPath"
- # *************************** Automation black ***************************
-
Write-Host "Copy checkinstall.cmd into the ISO"
New-CheckInstall
Copy-Item "$env:temp\checkinstall.cmd" "$($scratchDir)\Windows\checkinstall.cmd" -force
@@ -282,25 +235,20 @@ 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
- if (!$keepEdge) {
- Write-Host "Removing Edge icon from taskbar"
- reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "Favorites" /f >$null 2>&1
- reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "FavoritesChanges" /f >$null 2>&1
- reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "Pinned" /f >$null 2>&1
- reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" /v "LayoutCycle" /f >$null 2>&1
- Write-Host "Edge icon removed from taskbar"
- if (Test-Path "HKLM:\zSOFTWARE\WOW6432Node") {
- # Remove leftovers of 64-bit installations
- # ---
- # Remove registry values first...
- reg delete "HKLM\zSOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge" /va /f > $null 2>&1
- reg delete "HKLM\zSOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" /va /f > $null 2>&1
- reg delete "HKLM\zSOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft EdgeWebView" /va /f > $null 2>&1
- # ...then the registry keys
- reg delete "HKLM\zSOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge" /f > $null 2>&1
- reg delete "HKLM\zSOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" /f > $null 2>&1
- reg delete "HKLM\zSOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft EdgeWebView" /f > $null 2>&1
- }
+ # Prevent Windows Update Installing so called Expedited Apps
+ @(
+ '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
+
+ # 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
@@ -341,7 +289,7 @@ public class PowerManagement {
Write-Host "Cleanup complete."
Write-Host "Unmounting image..."
- Dismount-WindowsImage -Path $scratchDir -Save
+ Dismount-WindowsImage -Path "$scratchDir" -Save
}
try {
@@ -403,7 +351,7 @@ public class PowerManagement {
reg unload HKLM\zSYSTEM
Write-Host "Unmounting image..."
- Dismount-WindowsImage -Path $scratchDir -Save
+ Dismount-WindowsImage -Path "$scratchDir" -Save
Write-Host "Creating ISO image"
@@ -417,7 +365,7 @@ public class PowerManagement {
Write-Host "[INFO] Using oscdimg.exe from: $oscdimgPath"
- $oscdimgProc = Start-Process -FilePath "$oscdimgPath" -ArgumentList "-m -o -u2 -udfver102 -bootdata:2#p0,e,b$mountDir\boot\etfsboot.com#pEF,e,b$mountDir\efi\microsoft\boot\efisys.bin `"$mountDir`" `"$($SaveDialog.FileName)`"" -Wait -PassThru -NoNewWindow
+ $oscdimgProc = Start-Process -FilePath "$oscdimgPath" -ArgumentList "-m -o -u2 -udfver102 -bootdata:2#p0,e,b`"$mountDir\boot\etfsboot.com`"#pEF,e,b`"$mountDir\efi\microsoft\boot\efisys.bin`" `"$mountDir`" `"$($SaveDialog.FileName)`"" -Wait -PassThru -NoNewWindow
$LASTEXITCODE = $oscdimgProc.ExitCode
diff --git a/gpedit-home.ps1 b/gpedit-home.ps1
deleted file mode 100644
index 43c552a3..00000000
--- a/gpedit-home.ps1
+++ /dev/null
@@ -1,4 +0,0 @@
-Get-ChildItem @(
- "$env:SystemRoot\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package*.mum",
- "$env:SystemRoot\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package*.mum"
-) | ForEach-Object { dism.exe /online /norestart /add-package:"$_" }
diff --git a/devdocs-generator.ps1 b/tools/devdocs-generator.ps1
similarity index 95%
rename from devdocs-generator.ps1
rename to tools/devdocs-generator.ps1
index 8f5f4081..792f6581 100644
--- a/devdocs-generator.ps1
+++ b/tools/devdocs-generator.ps1
@@ -563,17 +563,17 @@ function Add-LinkAttributeToJson {
}
Update-Progress "Loading JSON files" 10
-$tweaks = Get-Content -Path "config/tweaks.json" | ConvertFrom-Json
-$features = Get-Content -Path "config/feature.json" | ConvertFrom-Json
+$tweaks = Get-Content -Path "../config/tweaks.json" | ConvertFrom-Json
+$features = Get-Content -Path "../config/feature.json" | ConvertFrom-Json
Update-Progress "Getting last modified dates of the JSON files" 20
-$tweaksLastModified = (Get-Item "config/tweaks.json").LastWriteTime.ToString("yyyy-MM-dd")
-$featuresLastModified = (Get-Item "config/feature.json").LastWriteTime.ToString("yyyy-MM-dd")
+$tweaksLastModified = (Get-Item "../config/tweaks.json").LastWriteTime.ToString("yyyy-MM-dd")
+$featuresLastModified = (Get-Item "../config/feature.json").LastWriteTime.ToString("yyyy-MM-dd")
-$tweaksOutputDir = "docs/dev/tweaks"
-$featuresOutputDir = "docs/dev/features"
-$privateFunctionsDir = "functions/private"
-$publicFunctionsDir = "functions/public"
+$tweaksOutputDir = "../docs/dev/tweaks"
+$featuresOutputDir = "../docs/dev/features"
+$privateFunctionsDir = "../functions/private"
+$publicFunctionsDir = "../functions/public"
$functions = @{}
$itemnametocut = "WPF(WinUtil|Toggle|Features?|Tweaks?|Panel|Fix(es)?)?"
@@ -592,7 +592,7 @@ Load-Functions -dir $publicFunctionsDir
Update-Progress "Adding documentation links to JSON files" 50
# Define the JSON file paths
-$jsonPaths = @(".\config\feature.json", ".\config\tweaks.json")
+$jsonPaths = @("../config/feature.json", "../config/tweaks.json")
# Loop through each JSON file path
foreach ($jsonPath in $jsonPaths) {
@@ -612,12 +612,12 @@ foreach ($jsonPath in $jsonPaths) {
Set-Content -Path $jsonPath -Value $jsonString
}
-Add-LinkAttributeToJson -jsonFilePath "config/tweaks.json" -outputDir "dev/tweaks"
-Add-LinkAttributeToJson -jsonFilePath "config/feature.json" -outputDir "dev/features"
+Add-LinkAttributeToJson -jsonFilePath "../config/tweaks.json" -outputDir "dev/tweaks"
+Add-LinkAttributeToJson -jsonFilePath "../config/feature.json" -outputDir "dev/features"
Update-Progress "Generating content for documentation" 60
-$tweakResult = Generate-MarkdownFiles -data $tweaks -outputDir $tweaksOutputDir -jsonFilePath "config/tweaks.json" -lastModified $tweaksLastModified -type "tweak" -initialProgress 60
-$featureResult = Generate-MarkdownFiles -data $features -outputDir $featuresOutputDir -jsonFilePath "config/feature.json" -lastModified $featuresLastModified -type "feature" -initialProgress 70
+$tweakResult = Generate-MarkdownFiles -data $tweaks -outputDir $tweaksOutputDir -jsonFilePath "../config/tweaks.json" -lastModified $tweaksLastModified -type "tweak" -initialProgress 60
+$featureResult = Generate-MarkdownFiles -data $features -outputDir $featuresOutputDir -jsonFilePath "../config/feature.json" -lastModified $featuresLastModified -type "feature" -initialProgress 70
Update-Progress "Generating table of contents" 80
$allTocEntries = $tweakResult.TocEntries + $featureResult.TocEntries
@@ -639,6 +639,6 @@ $indexContent += Process-MultilineStrings @"
\\
"@
$indexContent += $(Generate-TypeSectionContent $featureEntries) + "`r`n"
-Set-Content -Path "docs/devdocs.md" -Value $indexContent -Encoding utf8
+Set-Content -Path "../docs/devdocs.md" -Value $indexContent -Encoding utf8
Update-Progress "Process Completed" 100
diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml
index 2ba9d635..639c95fb 100644
--- a/xaml/inputXML.xaml
+++ b/xaml/inputXML.xaml
@@ -647,23 +647,25 @@
Consider using a Math Solver, will help in making
development of these things much easier
-->
+
+
+ Margin="180,0,0,0">
+
+ Margin="205,0,0,0" Visibility="Collapsed"/>
Choose Windows SKU
- Choose Windows features you want to remove from the ISO
-
-
-
-
MicroWin features:
- Remove Telemetry and Tracking
- - Add ability to use local accounts
- - Remove Wifi requirement to finish install
- - Ability to remove Edge
- - Ability to remove Defender
- - Remove Teams
+ - Fast Install using "User" local account
+ - No internet requirement for install
- Apps debloat
@@ -988,7 +983,6 @@
- Click on the "Select Windows ISO" button and wait for WinUtil to process the image
It will be processed and unpacked which may take some time
- Once complete, choose which Windows flavor you want to base your image on
- - Choose which features you want to keep
- Click the "Start Process" button
The process of creating the Windows image may take some time, please check the console and wait for it to say "Done"
- Once complete, the target ISO file will be in the directory you have specified