Information Technology Grimoire

Version .0.0.1

IT Notes from various projects because I forget, and hopefully they help you too.

Remove Bloatware PowerShell

PowerShell, Admin

All of this is done via powershell scripts in admin. Just paste info.

Bloatware

I noticed I had 423 instances of “YourPhone” and it’s something I don’t use. That let me to investigate all of the bloatware on my new windows 11 install. Here is the 1 off to remove “YourPhone”

# Uninstall YourPhone on profile
Get-AppxPackage Microsoft.YourPhone -AllUsers | Remove-AppxPackage
Get-AppxProvisionPackage -Online | where DisplayName -EQ "Microsoft.YourPhone" | Remove-AppxProvisionedPackage -Online

General Bloatware Investigations

Listing Services

# all Running Services
Get-Service | Select-Object DisplayName, Status, StartType | Format-Table -AutoSize | findstr Running

Do not simply paste this, but if you have determined several services you want to disable and need it scripted:

# List of services to disable
$servicesToDisable = @(
    "DiagTrack", # Connected User Experiences and Telemetry
    "edgeupdate", # Microsoft Edge Update Service
    "edgeupdatem", # Microsoft Edge Update Service
    "DoSvc", # Delivery Optimization
    "DiagHub.StandardCollector.Service", # Diagnostics Hub Standard Collector Service
    "GameDVR", # GameDVR and Broadcast User Service
    "PcaSvc", # Program Compatibility Assistant Service
    "RemoteRegistry", # Remote Registry
    "RetailDemo", # Retail Demo Service
    "wisvc", # Windows Insider Service
    "XblAuthManager", # Xbox Live Auth Manager
    "XblGameSave", # Xbox Live Game Save
    "XboxNetApiSvc" # Xbox Live Networking Service
)

# Function to stop and disable services
function Disable-Services {
    param (
        [string[]]$services
    )
    foreach ($service in $services) {
        try {
            $svc = Get-Service -Name $service -ErrorAction Stop
            Write-Host "Stopping and disabling service: $($svc.DisplayName)"
            Stop-Service -Name $service -Force -ErrorAction Stop
            Set-Service -Name $service -StartupType Disabled -ErrorAction Stop
            Write-Host "Successfully stopped and disabled: $($svc.DisplayName)"
        } catch {
            Write-Host "Failed to stop or disable service: $service. Error: $_"
        }
    }
}

# Disable the listed services
Disable-Services -services $servicesToDisable

Write-Host "Selected services have been stopped and disabled."

Listing Provisioned Packages

# List all Provisioned Packages
DISM /Online /Get-ProvisionedAppxPackages | select-string Packagename

The output being something like this:

PackageName : AppUp.IntelGraphicsExperience_1.100.5487.0_neutral_~_8j3eq9eme6ctt
PackageName : Clipchamp.Clipchamp_3.1.10220.0_neutral_~_yxz26nhyzhsrt
PackageName : Microsoft.549981C3F5F10_2022.507.447.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.DesktopAppInstaller_2024.506.2113.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.GamingApp_2022.507.447.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.Getstarted_2021.2312.1.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.HEIFImageExtension_1.1.861.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.Microsoft3DViewer_2024.2401.29012.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.MicrosoftEdge.Stable_124.0.2478.67_neutral__8wekyb3d8bbwe
PackageName : Microsoft.MicrosoftOfficeHub_2022.507.447.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.OutlookForWindows_1.2024.424.300_x64__8wekyb3d8bbwe
PackageName : Microsoft.Paint_11.2403.28.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.PowerAutomateDesktop_11.2404.251.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.RawImageExtension_2.3.1221.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.ScreenSketch_2022.2403.8.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.SecHealthUI_1000.25992.9000.0_x64__8wekyb3d8bbwe
PackageName : Microsoft.StorePurchaseApp_22403.1401.1.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.VCLibs.140.00_14.0.33519.0_x64__8wekyb3d8bbwe
PackageName : Microsoft.VP9VideoExtensions_1.1.451.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.WebMediaExtensions_1.1.663.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.WebpImageExtension_1.1.1221.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.Windows.DevHome_2024.405.859.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.Windows.Photos_2024.11050.3002.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.WindowsAlarms_2021.2403.8.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.WindowsCalculator_2021.2403.6.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.WindowsCamera_2022.2404.4.0_neutral_~_8wekyb3d8bbwe
PackageName : microsoft.windowscommunicationsapps_16005.14326.21904.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.WindowsNotepad_11.2402.22.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.WindowsSoundRecorder_2021.2403.3.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.WindowsStore_22404.1401.2.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.WindowsTerminal_3001.19.11213.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.XboxIdentityProvider_12.95.3001.0_neutral_~_8wekyb3d8bbwe
PackageName : Microsoft.XboxSpeechToTextOverlay_1.21.13002.0_neutral_~_8wekyb3d8bbwe
PackageName : MicrosoftCorporationII.MicrosoftFamily_0.2.40.0_neutral_~_8wekyb3d8bbwe
PackageName : MicrosoftCorporationII.QuickAssist_2024.326.133.0_neutral_~_8wekyb3d8bbwe
PackageName : MicrosoftTeams_24060.3102.2733.5911_x64__8wekyb3d8bbwe
PackageName : MicrosoftWindows.Client.WebExperience_524.13200.10.0_neutral_~_cw5n1h2txyewy
PackageName : MicrosoftWindows.CrossDevice_1.24051.36.0_neutral_~_cw5n1h2txyewy
PackageName : NVIDIACorp.NVIDIAControlPanel_8.1.966.0_x64__56jybvy8sckqj

Packages by Vendor

Get-WmiObject -Query "SELECT * FROM Win32_Product WHERE Vendor LIKE '%Oracle%'" | Select-Object Name, Version, Vendor

Name                       Version    Vendor
----                       -------    ------
Java 8 Update 411 (64-bit) 8.0.4110.9 Oracle Corporation
Java Auto Updater          2.8.411.9  Oracle Corporation

HP Specifics

Using the example above for “Oracle”, we can apply the same to the HP command center, which I do not use. It is supposed to optimize my computer related to gaming. If I needed it for gaming, this might be something to keep. If not “HP” you can try other vendors’ bloatware.

# List installed HP applications
$hpApplications = Get-WmiObject -Query "SELECT * FROM Win32_Product WHERE Vendor LIKE '%HP%'" | Select-Object Name, Version, Vendor
 
# List running HP services
$hpServices = Get-Service | Where-Object {$_.DisplayName -like "*HP*"} | Select-Object DisplayName, Status, StartType
 
# Output HP applications and services
$hpApplications | Format-Table -AutoSize
$hpServices | Format-Table -AutoSize

This gave me this output after it was disabled:

DisplayName                 Status StartType
-----------                 ------ ---------
HP App Helper HSA Service  Stopped  Disabled
HP Diagnostics HSA Service Stopped  Disabled
HP Network HSA Service     Stopped  Disabled
HP Omen HSA Service        Stopped  Disabled
HP System Info HSA Service Stopped  Disabled
HP Insights Analytics      Stopped  Disabled

I disabled them all with this:

# List of HP HSA services to disable
$hpHSAServices = @(
    "HP App Helper HSA Service",
    "HP Diagnostics HSA Service",
    "HP Network HSA Service",
    "HP Omen HSA Service",
    "HP System Info HSA Service"
)
 
# Function to stop and disable HP HSA services
function Disable-HSAServices {
    param (
        [string[]]$services
    )
    foreach ($service in $services) {
        $svc = Get-Service | Where-Object {$_.DisplayName -eq $service}
        if ($svc) {
            Write-Host "Stopping and disabling service: $service"
            Stop-Service -Name $svc.Name -Force
            Set-Service -Name $svc.Name -StartupType Disabled
        } else {
            Write-Host "Service $service not found."
        }
    }
}
 
# Disable HP HSA services
Disable-HSAServices -services $hpHSAServices

Which gave me the following output:

Stopping and disabling service: HP App Helper HSA Service
Stopping and disabling service: HP Diagnostics HSA Service
Stopping and disabling service: HP Network HSA Service
Stopping and disabling service: HP Omen HSA Service
Stopping and disabling service: HP System Info HSA Service

General Bloatware Removal

This applies to general bloatware on Windows 10 and Windows 11

# https://github.com/MSEndpointMgr/Windows inspiration

# List of bloatware and telemetry apps to remove
$bloatwareApps = @(
    "ActiproSoftwareLLC", # Actipro Software LLC app (various apps including text/IDE components)
    "AdobeSystemsIncorporated.AdobePhotoshopExpress", # Adobe Photoshop Express app
    "CandyCrush", # Candy Crush games
    "Duolingo", # Duolingo language learning app
    "EclipseManager", # Eclipse Manager (software management tool)
    "Facebook", # Facebook app
    "Flipboard", # Flipboard news aggregation app
    "HiddenCityMysteryofShadows", # Hidden City: Mystery of Shadows game
    "HuluLLC.HuluPlus", # Hulu app
    "king.com.FarmHeroesSaga", # Candy Crush games
    "Microsoft.549981C3F5F10", # Cortana Search
    "Microsoft.BingNews", # Microsoft Bing News app
    "Microsoft.BingWeather", # Microsoft Bing Weather app
    "Microsoft.GetHelp", # Microsoft Get Help app for support and troubleshooting
    "Microsoft.Messaging", # Messaging app for SMS messaging (mainly used for old SMS integration)
    "Microsoft.MixedReality.Portal", # Microsoft Mixed Reality Portal for VR/AR functionality
    "Microsoft.MicrosoftSolitaireCollection", # Microsoft Solitaire Collection game
    "Microsoft.MicrosoftStickyNotes", # Microsoft Sticky Notes app
    "Microsoft.Office.OneNote", # Microsoft OneNote app
    "Microsoft.People", # Microsoft People app for managing contacts
    "Microsoft.SkypeApp", # Skype app
    "Microsoft.Teams", # Microsoft Teams
    "Microsoft.Todos", # Microsoft To Do app
    "Microsoft.WindowsFeedbackHub", # Feedback Hub app for providing feedback to Microsoft
    "Microsoft.WindowsMaps", # Microsoft Maps app
    "Microsoft.Xbox.TCUI", # Xbox Gaming support for Game Core
    "Microsoft.XboxApp", # Main Xbox app for accessing Xbox Live features
    "Microsoft.XboxGameCallableUI", # Xbox related app for game callable UI
    "Microsoft.XboxGameOverlay", # Another Xbox game overlay app
    "Microsoft.XboxGamingOverlay", # Xbox Game Bar for game overlay
    "Microsoft.YourPhone", # Your Phone app for linking your phone to your PC
    "Microsoft.ZuneMusic", # Groove Music app for music playback
    "Microsoft.ZuneVideo", # Movies & TV app for video playback
    "Netflix", # Netflix app
    "Pandora", # Pandora app
    "Plex", # Plex media app
    "ROBLOXCORPORATION.ROBLOX", # ROBLOX game
    "Spotify", # Spotify music app
    "Twitter", # Twitter app
    "Wunderlist" # Wunderlist task management app
)

# Function to remove installed apps for all users
function Remove-InstalledApps {
    param (
        [string[]]$apps
    )
    foreach ($app in $apps) {
        $packages = Get-AppxPackage -AllUsers -Name $app
        if ($packages) {
            foreach ($package in $packages) {
                Write-Host "Removing installed application: $($package.Name)"
                try {
                    Remove-AppxPackage -Package $package.PackageFullName -ErrorAction Stop
                    Write-Host "Successfully removed: $($package.Name)"
                } catch {
                    Write-Host "Failed to remove: $($package.Name). Error: $_"
                }
            }
        } else {
            Write-Host "Application $app not found among installed applications."
        }
    }
}

# Function to remove provisioned apps
function Remove-ProvisionedApps {
    param (
        [string[]]$apps
    )
    foreach ($app in $apps) {
        $provisionedPackages = Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -eq $app}
        if ($provisionedPackages) {
            foreach ($package in $provisionedPackages) {
                Write-Host "Removing provisioned package: $($package.DisplayName)"
                try {
                    Remove-AppxProvisionedPackage -PackageName $package.PackageName -Online -ErrorAction Stop
                    Write-Host "Successfully removed provisioned package: $($package.DisplayName)"
                } catch {
                    Write-Host "Failed to remove provisioned package: $($package.DisplayName). Error: $_"
                }
            }
        } else {
            Write-Host "Provisioned package $app not found."
        }
    }
}

# Function to verify removal of apps
function Verify-Removal {
    param (
        [string[]]$apps
    )
    foreach ($app in $apps) {
        $installedPackages = Get-AppxPackage -AllUsers -Name $app
        $provisionedPackages = Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -eq $app}
        
        if ($installedPackages -or $provisionedPackages) {
            Write-Host "Verification failed: $app is still present."
        } else {
            Write-Host "Verification successful: $app has been removed."
        }
    }
}

# Execute removal and verification
try {
    # Remove installed apps
    Remove-InstalledApps -apps $bloatwareApps

    # Remove provisioned apps
    Remove-ProvisionedApps -apps $bloatwareApps

    # Verify removal of apps
    Verify-Removal -apps $bloatwareApps
} catch {
    Write-Host "An error occurred during the removal process: $_"
}

Write-Host "Bloatware and telemetry apps removal and verification complete."