-
Notifications
You must be signed in to change notification settings - Fork 2
/
experimental_unfuckery.ps1
50 lines (41 loc) · 1.6 KB
/
experimental_unfuckery.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Description:
# This script remove strang looking stuff which will probably result in a break
# of your system. It should not be used unless you want to test out a few
# things. It is named `experimental_unfuckery.ps1` for a reason.
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\take-own.psm1
Write-Output "Elevating priviledges for this process"
do {} until (Elevate-Privileges SeTakeOwnershipPrivilege)
Write-Output "Force removing system apps"
$needles = @(
#"Anytime"
"BioEnrollment"
#"Browser"
"ContactSupport"
#"Cortana" # This will disable startmenu search.
#"Defender"
"Feedback"
"Flash"
"Gaming"
#"Holo"
#"InternetExplorer"
#"Maps"
#"MiracastView"
"OneDrive"
#"SecHealthUI"
#"Wallet"
#"Xbox" # This will result in a bootloop since upgrade 1511
)
foreach ($needle in $needles) {
Write-Output "Trying to remove all packages containing $needle"
$pkgs = (Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages" |
Where-Object Name -Like "*$needle*")
foreach ($pkg in $pkgs) {
$pkgname = $pkg.Name.split('\')[-1]
Takeown-Registry($pkg.Name)
Takeown-Registry($pkg.Name + "\Owners")
Set-ItemProperty -Path ("HKLM:" + $pkg.Name.Substring(18)) -Name Visibility -Value 1
New-ItemProperty -Path ("HKLM:" + $pkg.Name.Substring(18)) -Name DefVis -PropertyType DWord -Value 2
Remove-Item -Path ("HKLM:" + $pkg.Name.Substring(18) + "\Owners")
dism.exe /Online /Remove-Package /PackageName:$pkgname /NoRestart
}
}