Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Windows 10 Inital Setup configuration script
- ##
- # DISCLAMER: This script is provided "as-is" and must be modified to fit your envrionment
- # The original developer cannot be held accountable for your failure to read the fine print
- ##
- Write-Host
- Write-Host "WARNING!!! Serious system instability can ocour if this script is interrupted" -ForegroundColor Black -BackgroundColor White
- Write-Host "Please take this time to create a restore image of your system, so that if this script fails, you can restore to a fresh install" -ForegroundColor Black -BackgroundColor White
- Write-Host
- Write-Host "DISCLAMER: This script is provided 'as-is' and must be modified to fit your envrionment" -ForegroundColor Black -BackgroundColor White
- Write-Host "The original developer cannot be held accountable for your failure to read the fine print" -ForegroundColor Black -BackgroundColor White
- Write-Host "By pressing 'Enter' you accept these terms, If you do not agree, end this program" -ForegroundColor Black -BackgroundColor White
- $key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
- # Ask for elevated permission
- ##
- If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) {
- Start-Process powershell.exe "-noProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
- Exit
- }
- ##
- # Privicy Settings
- ##
- Write-Host
- Write-Host "##"
- Write-Host "# Modifing Privicy Settings #"
- Write-Host "##"
- Write-Host
- # Disable Telemetry
- ##
- Write-Host "Disabling Telemetry"
- Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
- Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
- Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
- # Disable Wi-Fi Sense
- ##
- Write-Host "Disabling WiFi Sense"
- If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting")) {
- New-Item -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Force | Out-Null
- }
- Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 0
- Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 0
- # Enable Windows SmartScreen Filter
- ##
- Write-Host "Enabling Windows SmartScreen Filter"
- Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Type String -Value "RequireAdmin"
- Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation"
- # Raise UAC Level
- ##
- Write-host "Rasing UAC Level"
- Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConcentPromptBehaviorAdmin" -Type DWord -Value 1
- Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConcentPromptBehaviorUser" -Type DWord -Value 3
- Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "PromptOnSecureDesktop" -Type DWord -Value 1
- # Disable Bing Search in Start Menu
- ##
- Write-Host "Disabling Bing Search in Start Menu"
- Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Type Dword -Value 0
- # Disable Start Menu Suggestions
- ##
- Write-Host "Disabling Start Menu Suggestions"
- Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SystemPaneSuggestionsEnabled" -Type DWord -Value 0
- # Disable Location Tracking
- ##
- Write-Host "Disabling Location Tracking"
- Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 0
- Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 0
- # Disable Feedback
- ##
- Write-Host "Disabling Feedback"
- If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules")) {
- New-Item -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Force | Out-Null
- }
- Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" -Type DWord -Value 0
- # Disable Advertising ID
- ##
- Write-Host "Disabling Advertising ID"
- If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo")) {
- New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" | Out-Null
- }
- Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Type DWord -Value 0
- # Disable Cortana
- ##
- Write-Host "Disabling Cortana"
- If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Personalization\Settings")) {
- New-Item -Path "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" -Force | Out-Null
- }
- Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" -Name "AcceptedPrivicyPolicy" -Type DWord -Value 0
- If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization")) {
- New-Item -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Force | Out-Null
- }
- Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 1
- Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 1
- If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore")) {
- New-Item -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" -Force | Out-Null
- }
- Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" -Type DWord -Value 0
- If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search")) {
- New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Force | Out-Null
- }
- New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCortana" -PropertyType DWord -Value 0 -Force | Out-Null
- # Restrict Windows Update to Internet Download only
- ##
- Write-Host "Restricting Windows Update to Internet Download only"
- Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 0
- If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization")) {
- New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" | Out-Null
- }
- Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" -Name "SystemSettingsDownloadMode" -Type DWord -Value 0
- # Remove AutoLogger and restrict directory
- ##
- Write-Host "Removing AutoLogger and restrict directoy"
- $autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger"
- If (Test-Path "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl") {
- Remove-Item "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl"
- }
- icacls $autoLoggerDir /deny SYSTEM:`(OI`)`(CI`)F | Out-Null
- # Stop and disable Diagnostics Tracking
- ##
- Write-Host "Disabling Diagnostics Tracking"
- Stop-Service "DiagTrack"
- Set-Service "DiagTrack" -StartupType Disabled
- # Stop and disable WAP Push Service
- ##
- Write-Host "Disabling WAP Push Service"
- Stop-Service "dmwappushservice"
- Set-Service "dmwappushservice" -StartupType Disabled
- # Disable Microsoft Suggested Apps
- ##
- Write-Host "Disabling Microsoft Suggested Apps"
- Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SystemPaneSuggestionsEnabled" -Type DWord -Value 0
- # Disable Windows Tips and Feedback
- ##
- Write-Host "Disabling Windows Tips and feedback"
- Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SoftLandingEnabled" -Type DWord -Value 0
- # Disable Windows Lockscreen Spotlight
- ##
- #Write-host "Disabling Windows Lockscreen Spotlight"
- #Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "RotatingLockScreenEnabled" -Type DWord -Value 0
- # Enable Windows Powershell remoting without domain
- ##
- Write-Host "Enabling Windows Powershell remoting without domain"
- Set-item WSMan:\localhost\Client\TrustedHosts -Value "*" -Force
- ##
- # Service Tasks
- ##
- Write-Host
- Write-Host "##"
- Write-Host "# Modifing Service Tasks #"
- Write-Host "##"
- Write-Host
- # Enable Firewall
- ##
- Write-Host "Enabling Windows Firewall"
- Set-NetFirewallProfile -Profile * -Enabled True
- # Configure Windows Defender
- ##
- Write-Host "Configuring Windows Defender"
- Set-MpPreference -CheckForSignaturesBeforeRunningScan $True
- Set-MpPreference -DisableArchiveScanning $False
- Set-MpPreference -DisableBehaviorMonitoring $False
- Set-MpPreference -DisableBlockAtFirstSeen $False
- Set-MpPreference -DisableEmailScanning $False
- Set-MpPreference -DisableIOAVProtection $False
- Set-MpPreference -DisableIntrusionPreventionSystem $False
- Set-MpPreference -DisableRealtimeMonitoring $False
- Set-MpPreference -DisableRemovableDriveScanning $False
- Set-MpPreference -DisableScriptScanning $False
- Set-MpPreference -DisableScanningMappedNetworkDrivesForFullScan $True
- Set-MpPreference -DisableScanningNetworkFiles $True
- Set-MpPreference -HighThreatDefaultAction Quarantine
- Set-MpPreference -LowThreatDefaultAction Quarantine
- Set-MpPreference -MAPSReporting Advanced
- Set-MpPreference -ModerateThreatDefaultAction Quarantine
- Set-MpPreference -PUAProtection Enabled
- Set-MpPreference -RealTimeScanDirection Both
- Set-MpPreference -ScanParameters QuickScan
- Set-MpPreference -ScanScheduleDay Everyday
- Set-MpPreference -SevereThreatDefaultAction Quarantine
- Set-MpPreference -SignatureScheduleDay Everyday
- Set-MpPreference -SignatureScheduleTime 60
- Set-MpPreference -SubmitSamplesConsent Always
- Set-MpPreference -UnknownThreatDefaultAction Quarantine
- Get-MpPreference >> C:\WindowsDefenderSettings.txt
- # Disable Windows Update Automatic restart
- ##
- Write-Host "Disabling Window Update Automatic restart"
- Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "UxOption" -Type DWord -Value 1
- # Stop and disable Home Group services
- ##
- Write-Host "Disabling Home Group services"
- Stop-Service "HomeGroupListener"
- Set-Service "HomeGroupListener" -StartupType Disabled
- Stop-Service "HomeGroupProvider"
- Set-Service "HomeGroupProvider" -StartupType Disabled
- # Disable Lock Screen (Anniversary Update workaround)
- ##
- Write-Host "Disabling Lock Screen (Anniversary Update workaround)"
- If ([System.Environment]::OSVersion.Build -gt 14392) {
- $service = New-Object -com Schedule.Service
- $service.Connect()
- $task = $service.NewTask(0)
- $task.Settings.DisallowStartIfOnBatteries = $False
- $trigger = $task.Triggers.Create(9)
- $trigger = $task.Triggers.Create(11)
- $trigger.StateChange = 8
- $action = $task.Actions.Create(0)
- $action.Path = "reg.exe"
- $action.Arguments = "add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\SessionData /t REG_DWORD /v AllowLockScreen /d 0 /f"
- $service.GetFolder("\").RegisterTaskDevinition("Disable LockScreen", $task, 6, "NT AUTHORITY\SYSTEM", $null, 4) | Out-Null
- }
- ##
- # Remove Unwanted Applications
- ##
- Write-Host
- Write-Host "##"
- Write-Host "# Removing Unwanted Applications #"
- Write-Host "##"
- Write-Host
- # Remove OneDrive
- ##
- Write-Host "Removing OneDrive"
- Stop-Process -Name OneDrive -ErrorAction SilentlyContinue
- Start-Sleep -s 3
- $oneDrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe"
- If (!(Test-Path $oneDrive)) {
- $oneDrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe"
- }
- Start-Process $oneDrive "/uninstall" -NoNewWindow -Wait
- Start-Sleep -s 3
- Stop-Process -Name Explorer -ErrorAction SilentlyContinue
- Start-Sleep -s 3
- Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
- Remove-Item "$env:LOCAPAPPDATA\Microsoft\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
- Remove-Item "$env:PROGRAMDATA\Microsoft\Microsoft Onedrive" -Force -Recurse -ErrorAction SilentlyContinue
- If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") {
- Remove-item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse -ErrorAction SilentlyContinue
- }
- If (!(Test-Path "HKCR:")) {
- New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
- }
- Remove-Item -Path "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue
- Remove-Item -Path "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue
- # Remove OneDrive ads being displayed in Explorer (Creators Update)
- ##
- Write-Host "Removing OneDrive ads being displayed in Explorer (Creators Update)"
- New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ -name ShowSyncProviderNotifications -Value 0
- # Remove Default bloatware
- ##
- Write-Host "Removing default bloatware"
- Write-Host "Removing BingWeather"
- Get-AppxPackage *BingWeather* | Remove-AppxPackage
- Write-Host "Removing WindowsMaps"
- Get-AppxPackage *WindowsMaps* | Remove-AppxPackage
- Write-Host "Removing OneConnect"
- Get-AppxPackage *OneConnect* | Remove-AppxPackage
- Write-Host "Removing Messaging"
- Get-AppxPackage *Messaging* | Remove-AppxPackage
- Write-Host "Removing 3DBuilder"
- Get-AppxPackage *3DBuilder* | Remove-AppxPackage
- Write-Host "Removing MiracastView"
- Get-AppxPackage *MiracastView* | Remove-AppxPackage
- Write-Host "Removing ContactSupport"
- Get-AppxPackage *ContactSupport* | Remove-AppxPackage
- Write-Host "Removing WindowsFeedbackHub"
- Get-AppxPackage *WindowsFeedbackHub* | Remove-AppxPackage
- Write-Host "Removing WindowsCamera"
- Get-AppxPackage *WindowsCamera* | Remove-AppxPackage
- Write-Host "Removing GetStarted"
- Get-AppxPackage *GetStarted* | Remove-AppxPackage
- Write-Host "Removing ZuneVideo"
- Get-AppxPackage *ZuneVideo* | Remove-AppxPackage
- Write-Host "Removing Twitter"
- Get-AppxPackage *Twitter* | Remove-AppxPackage
- Write-Host "Removing Netflix"
- Get-AppxPackage *Netflix* | Remove-AppxPackage
- Write-Host "Removing People"
- Get-AppxPackage *People* | Remove-AppxPackage
- Write-Host "Removing ZuneMusic"
- Get-AppxPackage *ZuneMusic* | Remove-AppxPackage
- Write-Host "Removing SkypeApp"
- Get-AppxPackage *SkypeApp* | Remove-AppxPackage
- Write-Host "Removing WindowsSoundRecorder"
- Get-AppxPackage *WindowsSoundRecorder* | Remove-AppxPackage
- Write-Host "Removing MicrosoftStickyNotes"
- Get-AppxPackage *MicrosoftStickyNotes* | Remove-AppxPackage
- Write-Host "Removing WindowsAlarms"
- Get-AppxPackage *WindowsAlarms* | Remove-AppxPackage
- Write-Host "Removing OneNote"
- Get-AppxPackage *OneNote* | Remove-AppxPackage
- Write-Host "Removing MicrosoftOfficeHub"
- Get-AppxPackage *MicrosoftOfficeHub* | Remove-AppxPackage
- Write-Host "Removing OneNote"
- Get-AppxPackage *Office.OneNote* | Remove-AppxPackage
- Write-Host "Removing MicrosoftSolitaireCollection"
- Get-AppxPackage *MicrosoftSolitaireCollection* | Remove-AppxPackage
- Write-host "Removing Facebook"
- Get-AppxPackage *Facebook* | Remove-AppxPackage
- Write-host "Removing Minecraft"
- Get-AppxPackage *Minecraft* | Remove-AppxPackage
- Write-Host "Removing CandyCrush"
- Get-AppxPackage *CandyCrush* | Remove-AppxPackage
- ##
- # Windows End-of-script tasks
- ##
- Write-Host
- Write-Host "##"
- Write-Host "# End-of-script tasks #"
- Write-Host "##"
- Write-Host
- # Enable boot menu
- ##
- Write-Host "Enabling boot menu"
- bcdedit --% /set {bootmgr} displaybootmenu true
- bcdedit --% /set {bootmgr} timeout 7
- # Restart
- ##
- Write-Host
- Write-Host "Press any key to restart your system..." -ForegroundColor Black -BackgroundColor White
- $key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
- Write-Host "Restarting..."
- Restart-Computer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement