Uninstall the Bloatware Windows 10 came with

Page 5 of 5 FirstFirst ... 345

  1. Posts : 66
    Windows 10 Pro 64 bit
       #41

    Define bloatware...


    Hi everyone,

    I personally found this thread both interesting and confusing and, if I may, I would like sharing with you a couple of observations.

    1. The definition of bloatware is definetly subjective and even a "tiny" app may represent for someone a relatively big intruder inside the supposed "purity" of his or her machine IF its presence is not a totally free choice. Considering that each and everyone of us is definetely entitled to feel comfortable with his or her own machine, the mere fact of not being in control of the situation due to external intromissions should be regarded as a violation of our legitimate freedom of educatedly deciding whether having specific software installed or not.

    2. Beyond such a subjective approach, which could be shared only by those who are compulsively obsessive "clean" installers like myself, there is however an objective issue which cannot be denied even by those who have strenuosly defended the fact that messing with pre-installed apps is, in the best hypothesis, a waste of time: someone who uses his or her PC e.g. for work reasons is definetley entitled to have a choice about the imposed presence of Xbox, Candy Crush Soda Saga, Asphalt 8, March of Empires or Minecraft (try and "clean" install Windows 10 Creators Update and you'll see what I'm talking about). There is no way of getting around this, I bought a license for an OS I use everyday mainly to work and the producer is forcing me to talk "gamish"... I cannot feel sorry for not wanting that stuff around at all.

    3. Before the followers of the "uninstall-'em-all" bandwagon jump on and cry hurrah, I would point out that all of the above may eventually result in a rather steryle, if not straghtaway dangerous, exercise providing the removal of the unwanted alleged bloatware is performed in an unresponsible way. In this sense and with all due respect for every contributor, I personally deem the fact of publishing a mere list of uninstall instructions (with just a vague warning to how theoretically harmful it could turn out) somehow confusing, above all for not so advanced users like myself.

    In conclusion, IMHO the point is NOT whether it is right or not uninstalling apps that nobody asked for in the first place, because this is a legitimate act of freedom regardlessly of how tiny or HD-wise irrelevant are those apps, but how we are supposed to do that. In this sense I would suggest to move from simple lists without explanations to the great tutorial by Master Brink:

    Windows 10: Uninstall Apps in Windows 10

    As my first and only intention is giving a humble contribution to a Forum where I come to learn and for which I remain deeply grateful to each and everyone of you, I definitely hope that no one will perceive this comment negatively in any possible way.
      My Computer


  2. Posts : 2,832
    Windows 10 Pro X64
       #42

    Hi,

    Does Windows run any better/faster when al apps you don't want have been removed ?
    I do not think so going by my experience. If you want a W7 like W10 then going Enterprise LTBS may be an option.

    Sure, first thing I do is remove all games and other stuff I'll never use but other than that I'll just let it run as is.

    Cheers,
      My Computers


  3. Posts : 11,247
    Windows / Linux : Arch Linux
       #43

    teachermark said:
    If we didn't make presumptions when posting helpful fixes and hacks this forum would be a blank space!
    I offer posts based on the assumption that there are some people who have the same issues that I have.
    It seems the original post starter has done the same.

    I uninstalled and removed everything possible on my computers after I installed Windows 10.
    I want an operating system to operate as a platform to run other programs, not as a way for Microsoft to tell me the weather, clutter the place up with childish tiles and other useless 'apps' that just take up space.
    My computer isn't a toy!

    Also - 'bloatware' doesn't mean that it necessarily takes up too much space and/or resources.
    It qualifies as 'bloatware' if it is in the way, is not wanted and/or needed or visibly interferes with the way I like things set out.

    It's bloatware if I didn't ask for it, don't want it and can't get rid of it!

    In my view Cortana is 'bloatware.'
    I've turned it off and minimized it so it's impact is less, but it's still there, like Edge, on my computer when I would rather they were both in a pit of fire near the devil's testicles.
    Hi there

    I'm all in favour of sensible suggestions - for example I really LOATHE this new trend of making new hardware devices Voice activated --there's enough extraneous noise on this planet as it is - so if I could get rid of Cortana I would - I've dog muzzled it anyway so it doesn't make a sound but it still seems to make suggestions from time to time in the notifications area - but assuming everybody likes or needs the same things is BONKERS.

    I've never used (or want to use) an XBOX in my life but I'm pretty sure what the reaction would be if I suggested that XBOXES were just for pimply faced teenage nerds !!!! so I believe as people say in the UK "Horses for Courses".

    As for "If you didn't ask for it it must be bloatware" -- well if you buy a car you don't ask for a Gas tank or a Steering wheel -- are those bloatware !!

    Ms puts together a reasonable selection of applications that it thinks based on market research will be the most popular and on the whole most of the stuff is fine.

    The most sensible suggestion is to make as many of these as possible easy to uninstall - some people use computers for quite different things than pure hobbyists etc -- and especially these days where you might be working as an external consultant with many different companies you don't want your PC to be loaded with Games etc (unless of course you are working as a Games developer !!).

    I myself hate the latest idea with Tiles on the screen --it's NOT a mobile phone and get rid of most of them --I HATED W8 and would any day prefer the elegance of the Windows 7 menu - but W10 is OK and runs mostly fine.

    Where I draw the line is in some of those wretched Store apps and the inevitable targeting of ads and possibly email spam -- if either of these things become seriously irritating then I will give up - currently though it's OK - but I'm watching !!!!

    Cheers
    jimbo
      My Computer


  4. Posts : 5,478
    2004
       #44

    Lmbrt said:
    IMHO the point is NOT whether it is right or not uninstalling apps that nobody asked for in the first place, because this is a legitimate act of freedom regardlessly of how tiny or HD-wise irrelevant are those apps, but how we are supposed to do that. .
    You can uninstall them with CCleaner. Or if you are repeatedly getting embuggered by it you can uninstall them in audit mode and make your own clean install image.

    Or you can make yourself a script to run to delete the ones you don't want.

    All these are described in tutorials on this forum and there is ZERO point moaning about it. Make it how you want or don't.

    FWIW this is what I run after a clean install.

    PHP Code:
    # This script displays a menu to run the following functions either individually or all of them sequentially.
    # Each function prompts to run unless taking the ALL option.
    #  
    # Currently the functions are :     Disk Cleanup (all options) using "cleanmgr" command
    #                                    Compress OS using "compact" command
    #                                    Compress other identified directories using "compact" command
    #                                    Delete everything from "SoftwareDistribution\Downloads"
    #                                    Delete everything in "%windir%\Temp" and "%localappData%\Temp" (for current user)
    #                                    Remove all modern apps (that are possible to remove with "Remove-AppxPackage")
    #                                    DISM /online /Cleanup-Image /StartComponentCleanup /ResetBase
    #                                    Turn off System Protection
    #                                    Turn off hibernation
    #                                    Set pageFile to 200MB (minimum recommended to allow memory dumps to be produced)
    #                                    Run disk defragmentation/Trim using "defrag.exe"
    #                                    Reboot if required

    # TODO
    # 1. Update location of sdelete (or rewrite it)
    # 2. The 'quiet' functionality (i.e. start the script with ./Shrink-Windows.ps1 -q) will suppress the menu and any prompts to screen. 
    #    This is not properly implemented yet though - need to add RunOnce key to run stuff after reboot perhaps.  Unsure if this is best solution
    # 3. Add more stuff to temp file clearer (copy old-timer TFC?).  Alternatively just drop this function.
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    # Initialise
    # ~~~~~~~~~~
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    param ([char]$q)
    If (
    $q -eq 'Q' -or $q -eq 'q') {$quiet=$true}
    $ErrorActionPreference="silentlyContinue"
    $runAll=$false
    $rebootRequired
    =$false
    $global
    :prompt=0
    $sdeletePath
    ="$env:homeDrive$env:homePath\OneDrive\Programs\SysinternalsSuite\sdelete.exe"

    $OS=Get-WmiObject Win32_OperatingSystem
    If (-not $OS.Caption.Contains("10") -and -not $OS.Caption.Contains("2016")) {
        If (-
    not $quiet) {Read-Host -Prompt "This script only works with Windows 10.  Press Enter to exit."}
        exit
    }

    $Manufacturer=Get-WmiObject -Class Win32_BaseBoard | ForEach-Object {$_.Manufacturer}
    if ((
    $Manufacturer -eq "Microsoft Corporation") -or ($Manufacturer -eq "VMWARE") -or ($Manufacturer -eq "VirtualBox")) {
        
    $thisIsVirtualMachine=$true
    }
    Else { 
    $thisIsVirtualMachine=$false }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    # Functions
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function askQuestion ($caption$clearHost=1$defaultAnswer=0)
    # Normally, clear the screen and defualt answer (0 = Yes) if not running everything.
    {
        If (
    $runAll) {$global:prompt=$defaultAnswer}
        Else {
            If (
    $ClearHost) {Clear-Host}
            
    $message="Enter choice"
            
    $choices = @("&Yes","&No")
            
    $choicedesc = New-Object System.Collections.ObjectModel.Collection[System.Management.Automation.Host.ChoiceDescription]
            
    $choices | foreach  { $choicedesc.Add((New-Object "System.Management.Automation.Host.ChoiceDescription" -ArgumentList $_))}
            
    $global:prompt $Host.ui.PromptForChoice($caption$message$choicedesc$defaultAnswer)
        }
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function PressAnyKey
    # This function displays "Press Enter to continue" If running in interactive menu mode.

    {    Write-HostWrite-Host
        
    If (-not $quiet) {
            
    Read-Host -Prompt "Press Enter to return to menu"
            
    Clear-Host
            mainMenu
        
    }
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function bootRequired
    # This function asks whether to reboot now or later.

    {    If ($rebootRequired) {
            If (
    $runAll -and -$quiet) {} # Add a Run-One Key to call script again?  Not sure if this is practical.
            
            
    ElseIf ($runAll) {Write-Host "Reboot required.  Run ALL Option again after reboot to continue." -f yellow}
            
            
    askQuestion "Choose Y to reboot now or N to reboot manually later" 0 1 
            
    Switch ($prompt)
            {    
    {Restart-Computer -ComputerName $Env:COMPUTERNAME -Force}
                
    {return}
            }
        } 
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function takeOwn-folder ($folder)
    {    
    $toplevel=Split-Path $folder -leaf

        
    # Delete the old .acl file (in case it exists)
        
    If (Test-Path "$PSScriptRoot\$toplevel.acl") {Remove-Item "$PSScriptRoot\$toplevel.acl" -Force -ErrorAction 0}
            
        
    # backup ACLs for WindowsApps folder
        
    icacls "$folder/save "$PSScriptRoot\$toplevel.acl" /
            
        
    # take ownership
        
    takeown /"$folder/
            
        
    # Grant full rights to current user
        
    icacls "$folder--% /grant "%USERDOMAIN%\%USERNAME%":(F) /t
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function restoreOwn-folder ($folder$owner)
    {    
    $toplevel=Split-Path $folder -leaf
        $parentPath
    =Split-Path -parent $folder
        
        
    # reset owner of WindowsApps to the owner passed in as parameter - e.g. "NT SERVICE\TrustedInstaller"
        
    icacls "$folder/setowner "$owner/t
                
        
    # Restore ACLs
        
    icacls "$parentPath/restore "$PSScriptRoot\$toplevel.acl"
                
        
    # Tidy up
        
    Remove-Item "$PSScriptRoot\$toplevel.acl" -Force -ErrorAction 0
        
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function DiskCleanup
    # This function writes a key StateFlags0032 to all subkeys in HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches
    # and then calls cleanmgr.exe /sagerun:32 to process them.  The number 32 is not important - only the same of the key in the registry
    # must match that on the sagerun parameter.

    {    
        
    askQuestion "Disk Cleanup?"
        
    Switch ($prompt)
        {    

            
    {    Try
                {    
    $VName="StateFlags0032"
                    
    $DirPath="HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"
                    
                    
    # Folders Names which will been cleaned.  Note some of these (for example "RetailDemo Offline Content") are deleted from
                    # the registry after first run.  Messages like "Key not found" are therefore not important and can be ignored.
                    
    $TempFolders=@(
                    
    "Active Setup Temp Folders",
                    
    "BranchCache",
                    
    "Content Indexer Cleaner",
                    
    "Delivery Optimization Files",
                    
    "Downloaded Program Files",
                    
    "GameNewsFiles",
                    
    "GameStatisticsFiles",
                    
    "GameUpdateFiles",
                    
    "Internet Cache Files",
                    
    "Memory Dump Files",
                    
    "Offline Pages Files",
                    
    "Old ChkDsk Files",
                    
    "Previous Installations",
                    
    "Recycle Bin",
                    
    "RetailDemo Offline Content",
                    
    "Service Pack Cleanup",
                    
    "Setup Log Files",
                    
    "System error memory dump files",
                    
    "System error minidump files",
                    
    "Temporary Files",
                    
    "Temporary Setup Files",
                    
    "Temporary Sync Files",
                    
    "Thumbnail Cache",
                    
    "Update Cleanup",
                    
    "Upgrade Discarded Files",
                    
    "User file versions",
                    
    "Windows Defender",
                    
    "Windows Error Reporting Archive Files",
                    
    "Windows Error Reporting Queue Files",
                    
    "Windows Error Reporting System Archive Files",
                    
    "Windows Error Reporting System Queue Files",
                    
    "Windows Error Reporting Temp Files",
                    
    "Windows ESD installation files",
                    
    "Windows Upgrade Log Files")
                        
                    
    Write-Host "The following are selected to be cleaned by cleanmgr" -f cyan
                    
                    $error
    .clear()
                    For(
    $i=0;$i -lt $TempFolders.Count$i++)
                    {    
    $RegKey=$DirPath "\" + $TempFolders[$i]
                        
    $StateValue=(Get-ItemProperty $RegKey).$VName
                        If ($?)
                        {    If (
    $Error.categoryinfo) {write-host "Key not found " -f red  -NoNewline; write-host "$TempFolders[$i] -f White}
                            ElseIf (-not 
    $StateValue)
                            {    New-ItemProperty -Path 
    $RegKey -Name $VName -Value "2" -PropertyType "dword" | out-null
                                write-host "
    Key added     " -NoNewline; write-host "$TempFolders[$i] -f White
                            }
                            Else 
                            {    Set-ItemProperty -Path 
    $RegKey -Name $VName -Value "2"
                                write-host "
    Key updated   " -NoNewline; write-host "$TempFolders[$i] -f White
                            }
                        }
                        
    $error.clear()
                        
    $RegKey=$DirPath
                    }
                    Write-Host    "
    End of List" -f cyan
                    
                    # 32 is a random number - just has to match 
    $VName variable
                    CLEANMGR /sagerun:32
                    Write-Host  "
    Disk Cleanup running asynchronously..." -f white
                }
                Catch
                {
                    If (-not 
    $quiet) {Read-Host -Prompt "Disk cleanup failed.  Press Enter to continue with other tasks and run it manually afterwards."}
                }
            }
            1 {    Write-Host "
    Request cancelled cleanmgr.exe not run" -f yellow}
        }
        If (-not 
    $runAll) {pressAnyKey}
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function compactOS 
    {
        # This function sets the compactos flag on.  This remains on until turned off again explicity so this only needs to run once.
        # Only compact If not already done as it remains the same until turned off.
        If ((compact /compactos:query) -like '*The system is in the Compact state*') {
            Write-Host 'The system is already in the Compact state'
            Sleep 1
        } 

        Else {
            askQuestion  "
    Compact OS?"
            Switch (
    $prompt)
            {    0    {    compact /compactos:always}    
                1    {    Write-Host "
    Request cancelled OS not compacted" -f yellow}
            }
            If (-not 
    $runAll) {pressAnyKey}
        }
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function compactOther
    # This function compresses named directories (see below) with compression algorithm xpress16k.  This does not apply to items added after so
    # the directory is then compressed without specIfying /exe:xpress16k.  This defaults to xpress4k and will apply only to thinks added later as the 
    # /f (force) switch is not specIfied.
    {
        # Array is 3 dimensions.
        #  Note in Powershell array index starts from 0    
        #    
    $compactDirectory[$i][0] is the folder
        #     
    $compactDirectory[$i][1] is the owner
        #     
    $compactDirectory[$i][2] is the compression
        # If ownership needs changing put the standard owner in second element so it can be reset correctly.  Otherwise leave as ""    

        
    $compactDirectory=
        @(    
            ("
    $env:programFiles"                                ,""                                ,"xpress16k"),
            ("
    ${env:programFiles(x86)}"                            ,""                                ,"xpress16k"),
            ("
    $env:homeDrive$env:homePath\Documents"             ,""                                ,"xpress16k"),
            ("
    $env:homeDrive$env:homePath\OneDrive"             ,""                                ,"xpress16k"),
            ("
    $env:homeDrive$env:homePath\Downloads"             ,""                                ,"xpress16k"),    
            ("
    $env:LOCALAPPDATA\Packages"                        ,""                                ,"xpress16k")    
            ("
    $env:windir\Assembly"                                ,""                                ,"xpress8k"),
            ("
    $env:windir\Fonts"                                ,"NT SERVICE\TrustedInstaller"    ,"xpress16k"),
            ("
    $env:windir\InfusedApps"                            ,""                                ,"xpress16k"),
            ("
    $env:windir\Installer"                            ,""                                ,"lzx"),
            ("
    $env:windir\Panther"                                ,""                                ,"xpress16k"),
            ("
    $env:windir\SoftwareDistribution"                    ,""                                ,"xpress16k"),
            ("
    $env:windir\System32\Catroot2"                    ,""                                ,"xpress16k"),
            ("
    $env:windir\System32\LogFiles"                    ,""                                ,"xpress16k")
            #("
    $env:windir\WinSxS"                                ,"NT SERVICE\TrustedInstaller"    ,"xpress16k")
        )
        
        # these are causing errors (perhaps)
        #    ("
    $env:windir\System32\DriverStore\FileRepository"    ,""                                ,"lzx
        
    #    ("$env:programData"                    ,"NT AUTHORITY\SYSTEM"),
        #    ("$env:APPDATA"                        ,"NT AUTHORITY\SYSTEM"),
        #    

        
    askQuestion "Compact other directories?"
        
    Switch ($prompt)
        {    

            
    {        For($i=0;$i -lt $compactDirectory.Count$i++)
                {    
    $folder=$compactDirectory[$i][0]
                    
    $owner=$compactDirectory[$i][1]
                    
    $compression=$compactDirectory[$i][2]
                    
                    If (
    Test-Path $folder)    
                    {    
                        
    # take ownership If required
                        
    If ($owner -ne "") {takeOwn-folder -folder $folder
                        
                        
    # force xpress16k but this doesn't persist
                        
    Write-Host "Running " -NoNewLine
                        Write
    -Host "compact /c /s /a /f /q /i /exe:"$compression $folder"\*" -f White 
                        compact 
    ///////exe:$compression $folder\*
                                        
                        
    #restore ownership
                        
    If ($owner -ne "") {restoreOwn-folder -folder $folder -owner $owner}    
                    }
                    Else {    
    Write-Host "Path not found " -f red  -NoNewlinewrite-host $folder -f White}
                } 
            }
            
    1    {    Write-Host "Request cancelled - directories not compressed" -f yellow}
        }

         If (-
    not $runAll) {pressAnyKey}
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function clearDownloads
    # This function clears the C:\Windows\SoftwareDistribution\Download\ folder

    {
        
    askQuestion "Clear Windows update downloads?"
        
    Switch ($prompt)
        {    

            
    {    Remove-Item -path c:\Windows\SoftwareDistribution\Download\* -Recurse -Force -ErrorAction 0
                Write
    -Host "SoftwareDistribution\Download cleared" -f cyan
            
    }
            
    1    {Write-Host "Request cancelled - SoftwareDistribution\Download not cleared" -f yellow}
        }
        If (-
    not $runAll) {pressAnyKey}
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function clearTemp
    # This function clears C:\Windows\Temp and the current users C:\Users\xxxx\AppData\Local\Temp directories

    {
        
    askQuestion "Clear temp files?"
        
    Switch ($prompt)
        {    

            
    {    Remove-Item -path $env:windir\Temp\* -Recurse -Force -ErrorAction 0
                Write
    -Host "$env:windir\Temp cleared" -f cyan

                $localAppDataTemp
    ="$Env:TEMP"
                
    If (Test-Path $localAppDataTemp)
                {    
    Remove-Item "$LocalAppDataTemp\*" -Recurse -Force -ErrorAction 0
                    Write
    -Host "$env:TEMP cleared" -f cyan
                
    }
            }
            
    1    {Write-Host "Request cancelled - temp files not cleared" -f yellow}
        }
        If (-
    not $runAll) {pressAnyKey}
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function enable-privilege {
     
    param(
      
    ## The privilege to adjust. This set is taken from
      ## http://msdn.microsoft.com/en-us/library/bb530716(VS.85).aspx
      
    [ValidateSet(
       
    "SeAssignPrimaryTokenPrivilege""SeAuditPrivilege""SeBackupPrivilege",
       
    "SeChangeNotIfyPrivilege""SeCreateGlobalPrivilege""SeCreatePagefilePrivilege",
       
    "SeCreatePermanentPrivilege""SeCreateSymbolicLinkPrivilege""SeCreateTokenPrivilege",
       
    "SeDebugPrivilege""SeEnableDelegationPrivilege""SeImpersonatePrivilege""SeIncreaseBasePriorityPrivilege",
       
    "SeIncreaseQuotaPrivilege""SeIncreaseWorkingSetPrivilege""SeLoadDriverPrivilege",
       
    "SeLockMemoryPrivilege""SeMachineAccountPrivilege""SeManageVolumePrivilege",
       
    "SeProfileSingleProcessPrivilege""SeRelabelPrivilege""SeRemoteShutdownPrivilege",
       
    "SeRestorePrivilege""SeSecurityPrivilege""SeShutdownPrivilege""SeSyncAgentPrivilege",
       
    "SeSystemEnvironmentPrivilege""SeSystemProfilePrivilege""SeSystemtimePrivilege",
       
    "SeTakeOwnershipPrivilege""SeTcbPrivilege""SeTimeZonePrivilege""SeTrustedCredManAccessPrivilege",
       
    "SeUndockPrivilege""SeUnsolicitedInputPrivilege")]
      
    $Privilege,
      
    ## The process on which to adjust the privilege. Defaults to the current process.
      
    $ProcessId=$pid,
      
    ## Switch to disable the privilege, rather than enable it.
      
    [Switch] $Disable
    )

     
    ## Taken from P/Invoke.NET with minor adjustments.
     
    $definition=@'
     using System;
     using System.Runtime.InteropServices;
      
     public class AdjPriv
     {
      [DllImport("advapi32.dll", ExactSpelling=true, SetLastError=true)]
      internal static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall,
       ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen);
      
      [DllImport("advapi32.dll", ExactSpelling=true, SetLastError=true)]
      internal static extern bool OpenProcessToken(IntPtr h, int acc, ref IntPtr phtok);
      [DllImport("advapi32.dll", SetLastError=true)]
      internal static extern bool LookupPrivilegeValue(string host, string name, ref long pluid);
      [StructLayout(LayoutKind.Sequential, Pack=1)]
      internal struct TokPriv1Luid
      {
       public int Count;
       public long Luid;
       public int Attr;
    }
      
      internal const int SE_PRIVILEGE_ENABLED=0x00000002;
      internal const int SE_PRIVILEGE_DISABLED=0x00000000;
      internal const int TOKEN_QUERY=0x00000008;
      internal const int TOKEN_ADJUST_PRIVILEGES=0x00000020;
      public static bool EnablePrivilege(long processHandle, string privilege, bool disable)
      {
       bool retVal;
       TokPriv1Luid tp;
       IntPtr hproc=new IntPtr(processHandle);
       IntPtr htok=IntPtr.Zero;
       retVal=OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok);
       tp.Count=1;
       tp.Luid=0;
       If (disable)
       {
        tp.Attr=SE_PRIVILEGE_DISABLED;
    }
       Else
       {
        tp.Attr=SE_PRIVILEGE_ENABLED;
    }
       retVal=LookupPrivilegeValue(null, privilege, ref tp.Luid);
       retVal=AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero);
       return retVal;
    }
    }
    '
    @
     
    $processHandle=(Get-Process -id $ProcessId).Handle
     $type
    =Add-Type $definition -PassThru
     $type
    [0]::EnablePrivilege($processHandle$Privilege$Disable)
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function Takeown-Registry($key)
        
    # This function is used  by the removeApps function below.  Note TODO does not work for all root keys yet
        
    {    switch ($key.split('\')[0])
        {    "HKEY_CLASSES_ROOT" 
            {    $reg=[Microsoft.Win32.Registry]::ClassesRoot
                $key=$key.substring(18)
            }
            "HKEY_CURRENT_USER"
            {    $reg=[Microsoft.Win32.Registry]::CurrentUser
                $key=$key.substring(18)
            }
            "HKEY_LOCAL_MACHINE"
            {    $reg=[Microsoft.Win32.Registry]::LocalMachine
                $key=$key.substring(19)
            }
        }

        # set owner
        $key=$reg.OpenSubKey($key, "ReadWriteSubTree", "TakeOwnership")
        $owner=[Security.Principal.NTAccount]"Administrators"
        $acl=$key.GetAccessControl()
        $acl.SetOwner($owner)
        $key.SetAccessControl($acl)

        # set FullControl
        $acl=$key.GetAccessControl()
        $rule=New-Object System.Security.AccessControl.RegistryAccessRule("Administrators", "FullControl", "Allow")
        $acl.SetAccessRule($rule)
        $key.SetAccessControl($acl)
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function removeApps
    # This function removes unwanted Apps that come with Windows. If you  do not want
    # to remove certain Apps comment out the corresponding lines below.  Based on https://github.com/W4RH4WK/Debloat-Windows-10

    {
        askQuestion "Remove all modern apps?"
        Switch ($prompt)
        {    0    {$deleteAll=$true}
            1    {$deleteAll=$false}
        }

        If ($deleteAll)
        {    #Write-Host "Elevating privileges for this process" -f yellow
            #do {$result=enable-privilege SeTakeOwnershipPrivilege} 
            #until ($result -eq $true -or $xx >10)
            
            $apps=
            @(    
                "4DF9E0F8.Netflix"
                "9E2F88E3.Twitter"
                "ClearChannelRadioDigital.iHeartRadio"
                "D52A8D61.FarmVille2CountryEscape"
                "Facebook.Facebook"
                "Flipboard.Flipboard"
                "king.com.CandyCrushSaga"
                "king.com.CandyCrushSodaSaga"
                "HoloCamera"
                "HoloItemPlayerApp"
                "HoloShell"
                "Microsoft.3DBuilder"
                "Microsoft.Appconnector"
                "Microsoft.BingFinance"
                "Microsoft.BingNews"
                "Microsoft.BingSports"
                "Microsoft.BingWeather"
                "Microsoft.ConnectivityStore"
                "Microsoft.CommsPhone"
                "Microsoft.Getstarted"
                "Microsoft.Messaging"
                "Microsoft.Microsoft3DViewer"
                "Microsoft.MicrosoftOfficeHub"
                "Microsoft.MicrosoftSolitaireCollection"
                "Microsoft.MicrosoftStickyNotes"
                "Microsoft.MSPaint"
                "Microsoft.Office.OneConnect"
                "Microsoft.Office.OneNote"
                "Microsoft.Office.Sway"
                "Microsoft.OneConnect"
                "Microsoft.People"
                "Microsoft.SkypeApp"
                "Microsoft.Windows.Phone"
                "Microsoft.Windows.Photos"
                "Microsoft.WindowsAlarms"
                #"Microsoft.WindowsCalculator"
                "Microsoft.WindowsCamera"
                #"Microsoft.WindowsFeedbackApp"
                "Microsoft.WindowsMaps"
                "Microsoft.WindowsPhone"
                "Microsoft.WindowsSoundRecorder"
                #"Microsoft.WindowsStore"
                "Microsoft.XboxApp"
                "Microsoft.XboxSpeechToTextOverlay"
                "Microsoft.XboxGameOverlay"
                "Microsoft.ZuneMusic"
                "Microsoft.ZuneVideo"
                "microsoft.windowscommunicationsapps"
                "Microsoft.MinecraftUWP"
                "PandoraMediaInc.29680B314EFC2"
                "ShazamEntertainmentLtd.Shazam"    
                "Windows.MircastView"
            )

            Write-Host "Removing default apps" -f yellow
            ForEach ($app in $apps) {    
                Write-Host "Removing " -noNewLine; Write-Host $app -f white

                # Need to hide the progress bar as otherwise it remains on the screen            
                $ProgressPreference="SilentlyContinue"
                
                Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage
                $ProgressPreference="Continue"

                Get-AppXProvisionedPackage -Online |
                    where DisplayName -EQ $app |
                    Remove-AppxProvisionedPackage -Online
                        
                $appPath="$Env:LOCALAPPDATA\Packages\$app*"
                Remove-Item $appPath -Recurse -Force -ErrorAction 0            
            }
        } 
        Else {Write-Host "Request cancelled - apps not removed" -f yellow}        
        
        If (-not $runAll) {pressAnyKey}
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function runDISM
    # This function runs DISM /online /Cleanup-Image /StartComponentCleanup /ResetBase

    {
        askQuestion "Run DISM /online /Cleanup-Image /StartComponentCleanup /ResetBase?"
        Switch ($prompt)
        {    0    {DISM /online /Cleanup-Image /StartComponentCleanup /ResetBase}
            1    {Write-Host "Request cancelled - DISM not run" -f yellow}
        }
        If (-not $runAll) {pressAnyKey}
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function sysProtection
    # This function turns of system protection and therefore removes all restore points.  Space is only reclaimed after reboot.

    {    $IsSystemRestoreEnabled=Get-WmiObject -Namespace '
    root\default' -Class SystemRestoreConfig | ForEach-Object {$_.RPSessionInterval}
        If (-not $IsSystemRestoreEnabled) {Write-Host '
    System restore already disabled'; Sleep 1} 
        Else {
            askQuestion "Turn off System Protection?"
            Switch ($prompt)
            {    0
                {    Disable-ComputerRestore -drive "C:\"
                    Write-Host "System Protection turned off" -f cyan
                    Write-Warning "System configuration turned off.  Restore point storage will be reclained after reboot."
                    $rebootRequired=$true
                    If (-not $runAll) {bootRequired}
                }
                1     {Write-Host "Request cancelled - System Restore not changed" -f yellow}
            }
            If (-not $runAll) {pressAnyKey}
        }
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function powercfgOff
    # This function sets powercfg -h off to turn off hibernation.  C:\hiberfil.sys is deleted after reboot.

    {    $IsHibernateEnabled=Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Power -name HibernateEnabled | ForEach-Object {$_.HibernateEnabled}
        If (-not $IsHibernateEnabled) {Write-Host '
    Hibernation already disabled'; Sleep 1} 
        Else {    
            askQuestion "Turn off hibernation?"
            Switch ($prompt)
            {    0 
                {    powercfg -h off
                    Write-Host "Hibernation turned off" -f cyan
                    Write-Warning "Powercfg configuration changed. The computer must be restarted for the changes to take effect."
                    $rebootRequired=$true
                    If (-not $runAll) {bootRequired}
                }
                1     {Write-Host "Request cancelled - Hibernation not changed" -f yellow}
            }
            If (-not $runAll) {pressAnyKey}
        }
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function pageFile
    # This function sets pagefile to the smallest size that will still allow system dumps to be produced (200MB) If currently set to AutomaticManaged.  
    # This size is hard coded below.

    {    $IsAutomaticManagedPagefile=Get-WmiObject -Class Win32_ComputerSystem |ForEach-Object{$_.AutomaticManagedPagefile}
        $PageFileMaximumSize = Get-WmiObject Win32_PageFileSetting |ForEach-Object{$_.MaximumSize}
        If ($IsAutomaticManagedPagefile -or $PageFileMaximumSize -eq 200) {Write-Host '
    PageFile Size already set'; Sleep 1} 
        Else {    
            askQuestion "Set minimum sized (200MB) page file?"
            Switch ($prompt)
            {    0
                {    Function Set-PageFileSize
                    {    Param($DL,$InitialSize,$MaximumSize)

                        # copied this function from:
                        # https://gallery.technet.microsoft.com/scriptcenter/Script-to-configure-e8d85fee

                        #The AutomaticManagedPagefile property determines whether the system managed pagefile is enabled.
                        #This capability is not available on windows server 2003,XP and lower versions.
                        #Only If it is NOT managed by the system and will also allow you to change these.

                        $IsAutomaticManagedPagefile=Get-WmiObject -Class Win32_ComputerSystem |ForEach-Object{$_.AutomaticManagedPagefile}
                        If ($IsAutomaticManagedPagefile)
                        {    
                            #We must enable all the privileges of the current user before the command makes the WMI call.
                            $SystemInfo=Get-WmiObject -Class Win32_ComputerSystem -EnableAllPrivileges
                            $SystemInfo.AutomaticManagedPageFile=$false
                            [Void]$SystemInfo.Put()
                        }
                        
                        Write-Verbose "Setting pagefile on $DL" -cyan

                        #configuring the page file size
                        $PageFile=Get-WmiObject -Class Win32_PageFileSetting -Filter "SettingID='
    pagefile.sys $DL'"

                        Try
                        {    If ($PageFile -ne $null) {$PageFile.Delete()}
                            Set-WmiInstance -Class Win32_PageFileSetting -Arguments @{name="$DL\pagefile.sys"; InitialSize=0; MaximumSize=0} `
                            -EnableAllPrivileges |Out-Null
                                
                            $PageFile=Get-WmiObject Win32_PageFileSetting -Filter "SettingID='
    pagefile.sys $DL'"
                            $PageFile.InitialSize=$InitialSize
                            $PageFile.MaximumSize=$MaximumSize
                            [Void]$PageFile.Put()

                            Write-Host "Execution Results: Set page file size on ""$DL"" successful." -f cyan
                            Write-Warning "Pagefile configuration changed on computer '
    $Env:COMPUTERNAME'.  The computer must be restarted for the changes to take effect."
                            $rebootRequired=$true
                            If (-not $runAll) {bootRequired}
                        }
                        Catch {Write-Host "Execution Results: No Permission - Failed to set page file size on ""$DL""" -f red}
                    }

                    #************************* GO ********************************************************************************#
                    Set-PageFileSize -DL "C:" -InitialSize 200 -MaximumSize 200

                    # display current page file size information
                    Get-WmiObject -Class Win32_PageFileSetting -EnableAllPrivileges|Select-Object Name, `
                    @{Name="InitialSize(MB)";Expression={If ($_.InitialSize -eq 0){"System Managed"}Else{$_.InitialSize}}}, `
                    @{Name="MaximumSize(MB)";Expression={If ($_.MaximumSize -eq 0){"System Managed"}Else{$_.MaximumSize}}}| `
                    Format-Table -AutoSize
                }
                1    {Write-Host "Request cancelled - page file unchanged" -f yellow}
            }
            If (-not $runAll) {pressAnyKey}
        }
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function runDefrag 
    # This function calls defgag.exe which will either defragment, trim or optimize any attatched drives depending on their type (SSD, HDD, VHD)

    {
        askQuestion "Run Defrag/Trim?"
        Switch ($prompt) 
        {    0 
            {    $Command="$env:windir\System32\defrag.exe"
                $Parms="/c /h /o"
                $Prms=$Parms.Split(" ")
                & "$Command" $Prms
            }
            1     {Write-Host "Request cancelled - Defrag/Trim not run" -f yellow}
        }
        If (-not $runAll) {pressAnyKey}
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function ShrinkVM 
    # This function calls defgag.exe /x which will either consolidate free space and then run sdelete
    # Should only run this in VM - not on host.

    {
        askQuestion "Run Defrag & sdelete?"
        Switch ($prompt) 
        {    0 
            {    $Command="$env:windir\System32\defrag.exe"
                $Parms="C: /h /x"
                $Prms=$Parms.Split(" ")
                & "$Command" $Prms
                
                $Command="$env:windir\System32\defrag.exe"
                $Parms="C: /h /o"
                $Prms=$Parms.Split(" ")
                & "$Command" $Prms
                
                $Command=$sdeletePath
                $Parms="C: /z"
                $Prms=$Parms.Split(" ")
                & "$Command" $Prms
            }
            1     {Write-Host "Request cancelled - Defrag not run" -f yellow}
        }
        If (-not $runAll) {pressAnyKey}
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function DrawMenu
    # supportfunction to the Menu function below

    {    param ($menuItems, $menuPosition, $menuTitel)
        $fcolor="Green"
        $bcolor="Black"
        $l=$menuItems.length + 1
        cls
        $menuwidth=$menuTitel.length + 4
        Write-Host "`t" -NoNewLine
        Write-Host ("*" * $menuwidth) -fore $fcolor -back $bcolor
        Write-Host "`t" -NoNewLine
        Write-Host "* $menuTitel *" -fore $fcolor -back $bcolor
        Write-Host "`t" -NoNewLine
        Write-Host ("*" * $menuwidth) -fore $fcolor -back $bcolor
        Write-Host ""
        Write-debug "L: $l MenuItems: $menuItems MenuPosition: $menuposition"
        for ($i=0; $i -le $l;$i++)
        {    Write-Host "`t" -NoNewLine
            If ($i -eq $menuPosition)
            {    Write-Host "$($menuItems[$i])" -fore $bcolor -back $fcolor
            } 
            Else 
            {    Write-Host "$($menuItems[$i])" -fore $fcolor -back $bcolor
            }
        }
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function Menu
    # Generate a small "DOS-like" menu.
    # Choose a menuitem using up and down arrows, select by pressing ENTER

    {    param ([array]$menuItems, $menuTitel="MENU")
        $vkeycode=0
        $pos=0
        DrawMenu $menuItems $pos $menuTitel
        While ($vkeycode -ne 13)
        {    $press=$host.ui.rawui.readkey("NoEcho,IncludeKeyDown")
            $vkeycode=$press.virtualkeycode
            Write-host "$($press.character)" -NoNewLine
            If ($vkeycode -eq 38) {$pos--}
            If ($vkeycode -eq 40) {$pos++}
            If ($pos -lt 0) {$pos=$menuItems.length -1}
            If ($pos -ge $menuItems.length) {$pos=0}
            DrawMenu $menuItems $pos $menuTitel
        }
        Write-Output $($menuItems[$pos])
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function mainMenu
    # This function displays main menu and calls relevant function (or all of them by calling run-All).
    # If called in quiet (batch) mode the menu is not displayed. 

    {    If ($quiet) {run-All}
        Else {
            Clear-Host
            $options=
            "ALL",
            "Disk Cleanup",
            "Clear ""SoftwareDistribution\Downloads""",
            "Clear ""Temp"" files",
            "Remove modern apps",
            "DISM",
            "Turn off System Protection",
            "Turn off hibernation",
            "Set pageFile to 200MB",
            "Compact OS",
            "Compact other directories",
            "Defrag",
            "Prepare VM for Shrinking",
            "EXIT"

            $selection=Menu $options "CHOOSE YOUR COMMAND:"
            Switch ($selection)
            {    "ALL"{run-All; break}
                "Disk Cleanup" {DiskCleanup; break}
                "Clear ""SoftwareDistribution\Downloads""" {clearDownloads; break}
                "Clear ""Temp"" files" {clearTemp}
                "Remove modern apps" {removeApps; break}
                "DISM" {runDISM;break}
                "Turn off System Protection" {sysProtection; break}
                "Turn off hibernation" {powercfgOff; break}
                "Set pageFile to 200MB" {pageFile; break}
                "Compact OS" {compactOS; break}
                "Compact other directories" {compactOther; break}
                "Defrag" {runDefrag; break}
                "Prepare VM for Shrinking" {ShrinkVM; break}
                "EXIT" {exit}
            }
        }
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    function run-All
    # This function runs all all functions.  If interactive it returns to main menu.  In quiet (batch) mode it exits after completion.

    {    askQuestion "Run everything without prompting?" 1 1
        Switch ($prompt)
        {    0    {    
                    $runAll=$true
                    
                    sysProtection
                    powercfgOff
                    pageFile
                    bootrequired
                    DiskCleanup
                    removeApps
                    clearDownloads
                    clearTemp                
                    runDISM
                    compactOS
                    compactOther
                    runDefrag
                    if ($thisIsVirtualMachine) {ShrinkVM}
                    
                    $runAll=$false
                }
            1    {Write-Host "Request cancelled" -f yellow}
        }

        

        If ($quiet) {exit}
        Else {pressAnyKey}
    }
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    # GO!!!
    #------------------------------------------------------------------------------------------------------------------------------------------------------
    #Check VM identification is working
    If ($thisIsVirtualMachine) {askQuestion "This is a $Manufacturer VM right?"}
    Else {askQuestion "This $Manufacturer is not a VM right?"}
    Switch ($prompt) {1    {Write-Host "OK Request cancelled " -f yellow; Sleep 1; exit}}

    # Now run main loop
    while($true) {mainMenu} 
      My Computer


  5. Posts : 12
    Win10 Pro and Home
       #45

    Batch Remove Bloatware From Windows 10 using Command Line


    RemoveCrap.cmd
    .........................................
    @ECHO OFF
    PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""RemoveCrap.ps1""' -Verb RunAs}"

    ........................................

    RemoveCrap.ps1
    .........................................
    Get-AppxPackage *zunemusic* | Remove-AppxPackage;
    Get-AppxPackage *zunevideo* | Remove-AppxPackage;
    Get-AppxPackage Microsoft.MicrosoftStickyNotes | Remove-AppxPackage;
    Get-AppxPackage Microsoft.XboxApp | Remove-AppxPackage;
    Get-AppxPackage *OneNote* | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.XboxGameCallableUI" | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.XboxIdentityProvider" | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.BingTravel" | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.BingHealthAndFitness" | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.BingFoodAndDrink" | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.BingFinance" | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.3DBuilder" | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.XboxApp" | Remove-AppxPackage;
    Get-AppxPackage -name *FeedBackHub* | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.BingSports" | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.WindowsCamera" | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.Getstarted" | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.Office.OneNote" | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.WindowsMaps" | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.MicrosoftSolitaireCollection" | Remove-AppxPackage;
    Get-AppxPackage -name "Microsoft.MicrosoftOfficeHub" | Remove-AppxPackage


    .............................................
    Removes Feed Back Hub which others have said you could not uninstall. I had no problem.
    See Script above.

    I have both files in a folder and from the start button I have Command Prompt as Default not Powershell ...

    The RemoveCrap.cmd starts Powershell and looks for RemoveCrap.ps1 and executes the commands.

    This way no copy and paste... involved... Just Run the Batch File. Also I show two styles of Removal Code with 4 examples. One example is a combo of the other two.
    Last edited by alzio2020; 18 Sep 2017 at 14:33.
      My Computer


  6. Posts : 66
    Windows 10 Pro 64 bit
       #46

    lx07 said:
    You can uninstall them with CCleaner. Or if you are repeatedly getting embuggered by it you can uninstall them in audit mode and make your own clean install image.

    Or you can make yourself a script to run to delete the ones you don't want.

    All these are described in tutorials on this forum and there is ZERO point moaning about it. Make it how you want or don't.

    How so uselessly patronizing.

    There is ZERO point indeed in (ab)using capital letters and expressions like "moaning" or "or don't", while completely missing my point in the first place.

    Should you be interested, you might want to (re)read my post (top of the page) or, at least, my conclusion to it, right after the reference to Brink's tutorial.

    By the way, CCleaner alone can not do a thorough job, a few apps are simply not uninstallable and what you suggest does not prevent Win 10 from downloading and installing more bloatware, but as you most rightfully observed, all this is better "described in tutorials on this forum".
    Last edited by Lmbrt; 05 Oct 2017 at 04:16.
      My Computer


  7. Posts : 12
    Win10 Pro and Home
       #47

    Every Bloatware can be Uninstalled


    I posted how to run a cmd and activate the powershell uninstalls...
    I found that useful for myself being you can make a list of what you want to uninstall
    and because the lines are seperated by a semicolon ; you can delete as many as you want
    in one shot without any copy and paste ...not... one by one... I only put what was obvious
    and left out things like Camera that someone might want... so it's very easy to edit the list.
    What you want to uninstall is your business... The idea was to show how to make it as easy as possible.

    Also I have not run into any bloatware that can not be uninstalled.
    You can see it in the cmd line about permissions. ( Execution Policy Bypass )
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:59.
Find Us




Windows 10 Forums