CyberPolice

An epic windows securing and hardening script
Log | Files | Refs | README

DisableWinFeatures.ps1 (968B)


      1 Write-Host "CYBER POLICE are now disabling bad Windows features..." -ForegroundColor Gray
      2 $thispath = Split-Path -parent $MyInvocation.MyCommand.Definition
      3 $path = Split-Path -parent $thispath
      4 $WinFeatConfigFile = "$path\ConfigFiles\BadWinFeatures.txt"
      5 $tools="$path\Tools"
      6 $output = Get-content $path/CyberPoliceOutput/path.txt
      7 $cpuArc="$output\CPUARCHITECTURE.txt" 
      8 Switch ($cpuArc) { 
      9     AMD64 {$DISM="$tools\DISMAMD64"} 
     10     ARM64 {$DISM="$tools\DISMARM64"} 
     11     ARM {$DISM="$tools\DISMARM"}
     12     Default {$DISM="$tools\DISMAMD64"} 
     13 }
     14 
     15 Write-Host "Using DISM from location: $DISM\DISM" -ForegroundColor Gray
     16 Import-Module "$DISM\DISM"
     17 
     18 foreach ($line in Get-Content $WinFeatConfigFile) {
     19     Write-Host $allFeatures
     20     $check=Get-WindowsOptionalFeature -Online -FeatureName $line
     21     Write-Host $check
     22     pause
     23     Disable-WindowsOptionalFeature -Online -FeatureName $line
     24 }
     25 
     26 Write-Host "The CYBER POLICE have disabled bad Windows Features" -ForegroundColor Gray