Windows 10 Powershell: Turn Off Notifications, Disable CEIP, Uninstall Onedrive, Enable .Net 3.5
Windows 10 Powershell: Turn Off Notifications, Disable CEIP, Uninstall Onedrive, Enable .Net 3.5
Scenario: Youre setting up a reference Image and you want to clean up the machine, uninstall onedrive and enable .Net3.5.
Here is a quick and dirty powershell script that will do the trick:
##1) Instead of going through each category of Settings and Turn off Notifications just Disable Action Center
Write-Host “Disabling Action Center…”
If (!(Test-Path “HKCU:\Software\Policies\Microsoft\Windows\Explorer”)) {
New-Item -Path “HKCU:\Software\Policies\Microsoft\Windows\Explorer” | Out-Null
}
Set-ItemProperty -Path “HKCU:\Software\Policies\Microsoft\Windows\Explorer” -Name “DisableNotificationCenter” -Type DWord -Value 1
Set-ItemProperty -Path “HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications” -Name “ToastEnabled” -Type DWord -Value 0
############
#2)Turn OFF Microsoft Consumer Experience with local group policy and Scheduled Tasks
Set-ItemProperty ‘HKLM:\SOFTWARE\Microsoft\SQMClient\Windows’ CEIPEnable 0
#Disable CEIP Scheduled Tasks
schtasks /Change /TN “Microsoft\Windows\Customer Experience Improvement Program\UsbCeip” /Disable | out-null
###########
#3) Uninstall the Default Microsoft OneDrive
Write-Host “Uninstalling 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:LOCALAPPDATA\Microsoft\OneDrive” -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item “$env:PROGRAMDATA\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
###########
# 4) Enabling .NET 3.5 framework because a lot of programs still use it
Dism /online /Enable-Feature /FeatureName:NetFx3 /quiet /norestart