diff options
| -rw-r--r-- | .config/powershell/bootstrap.ps1 | 67 |
1 files changed, 4 insertions, 63 deletions
diff --git a/.config/powershell/bootstrap.ps1 b/.config/powershell/bootstrap.ps1 index 9a42114..1602e5b 100644 --- a/.config/powershell/bootstrap.ps1 +++ b/.config/powershell/bootstrap.ps1 @@ -10,11 +10,6 @@ Set-NetConnectionProfile -NetworkCategory Private $dotfiles_url = 'https://github.com/srdusr/dotfiles.git' $dotfiles_dir = "$HOME\.cfg" -# Imports -. $HOME\.config\powershell\initialize.ps1 -. $HOME\.config\powershell\ownership.ps1 -. $HOME\.config\powershell\onedrive.ps1 - # Function to handle errors function handle_error { param ($message) @@ -34,64 +29,10 @@ if (-not (Test-IsAdmin)) { handle_error "This script must be run as an administrator." } -$bloatware = @( - #"Anytime" - "BioEnrollment" - #"Browser" - "ContactSupport" - "Cortana" - #"Defender" - "Feedback" - "Flash" - #"Gaming" # Breaks Xbox Live Account Login - #"Holo" - #"InternetExplorer" - "Maps" - #"MiracastView" - "OneDrive" - #"SecHealthUI" - "Wallet" - #"Xbox" # Causes a bootloop since upgrade 1511? -) - -# Helper functions ------------------------ -function force-mkdir($path) { - if (!(Test-Path $path)) { - Write-Host "-- Creating full path to: " $path -ForegroundColor White -BackgroundColor DarkGreen - New-Item -ItemType Directory -Force -Path $path - } -} - -# Remove Features ------------------------ -foreach ($bloat in $bloatware) { - Write-Output "Removing packages containing $bloat" - $pkgs = (Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages" | - Where-Object Name -Like "*$bloat*") - - 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 - } -} - -# Remove default apps and bloat ------------------------ -Write-Output "Uninstalling default apps" -foreach ($app in $apps) { - Write-Output "Trying to remove $app" - Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -AllUsers - Get-AppXProvisionedPackage -Online | - Where-Object DisplayName -EQ $app | - Remove-AppxProvisionedPackage -Online -} - -# Prevents "Suggested Applications" returning -force-mkdir "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Cloud Content" -Set-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Cloud Content" "DisableWindowsConsumerFeatures" 1 +# Imports +. $HOME\.config\powershell\initialize.ps1 +. $HOME\.config\powershell\ownership.ps1 +. $HOME\.config\powershell\bloatware.ps1 # Configure PowerShell Write-Host "Configuring PowerShell" |
