Functions/Remove-ChromiumProfiles.ps1


function Remove-ChromiumProfiles {
    [CmdletBinding()]
    param (

    )

    $ChromeAppdataPath = Join-Path $env:LOCALAPPDATA "Chromium\User Data"

    if (Test-Path $ChromeAppdataPath) {

        $Profiles = Get-ChildItem $ChromeAppdataPath "Profile*" -Directory

        if ($Profiles) {
            Stop-ProcessSoft Chrome
            $Profiles | ForEach-Object {
                Write-Verbose "Removing: $($_.Name)"
                Remove-Item $_.FullName -Recurse -Force
            }
            Remove-Item (Join-Path $ChromeAppdataPath "Local State") -Verbose
        } else {
            Write-Warning "Nothing to remove"
        }
    } else {
        Write-Warning "Nothing to remove"
    }

}