Intune Proactive Remediation to Uninstall User version of Grammarly

When you run Uninstall.exe /S as system for Grammarly Nothing happens you have to run this as the user

<#
.DESCRIPTION
    Proactive Remediation | Detection
.EXAMPLE
    PowerShell.exe -ExecutionPolicy ByPass -File <ScriptName>.ps1
.NOTES
    VERSION     AUTHOR              CHANGE
    1.0         Jonathan Conway     Initial script creation
#>
 
# Discovery
try {
    # Run Test and store as variable
    $Test = Get-ChildItem -Path "$env:LOCALAPPDATA\Grammarly\DesktopIntegrations\" -Filter "Grammarly.Desktop.exe" -Recurse -Force -ErrorAction SilentlyContinue
 
    # Check where test is compliant or not - if no instances of Zoom are discovered then mark as 'Compliant' and exit with 0
    if ($null -eq $Test) {
        Write-Output "Compliant"
        exit 0
    }
    # If instances of Zoom are discovered then mark as 'Non Compliant' and exit with 1
    else {
        Write-Warning "Non Compliant"
        exit 1
    }
}
 
catch {
    # If any errors occur then return 'Non Compliant'
    Write-Warning "Non Compliant"
    exit 1
}
<#
This script will attempt to uninstall Grammarly user installs.

    Proactive Remediation | Remmediation 

User uninstall scripts based on https://social.technet.microsoft.com/Forums/en-US/9fb747b2-0084-4ed1-98a1-ecc9b0d05684/uninstall-mozilla-firefox-from-environment
#>


# Kill running processes
taskkill.exe /F /IM "Grammarly.Desktop.exe"

# Canva - uninstall user installs
Get-ChildItem -Path "$env:LOCALAPPDATA\Grammarly\DesktopIntegrations" Grammarly.Desktop.exe -Recurse -Force -ErrorAction SilentlyContinue | ForEach-Object {
    $SetupPath = $_.directory.tostring() + "\Uninstall.exe"
    $Arguments = " /S"
    $UserUninstall = Start-Process $SetupPath -ArgumentList $Arguments -PassThru -Wait -ErrorAction SilentlyContinue
    $UserUninstall.WaitForExit()
}

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...