Remove Zoom from all windows devices using remediation

Muhammad Zeeshan 100 Reputation points
2024-05-10T06:32:50.84+00:00

I have created script but its not helpful

Detection:

<#

.DESCRIPTION

Proactive Remediation | Detection

.EXAMPLE

PowerShell.exe -ExecutionPolicy ByPass -File <ScriptName>.ps1

.NOTES

VERSION     AUTHOR              CHANGE

1.0         Muhammad Zeeshan Fazal     Initial script creation

#>

Discovery

try {

# Run Test and store as variable

$Test = Get-ChildItem -Path "C:\Users\" -Filter "Zoom.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

}

Remediation:

<#

.DESCRIPTION

Proactive Remediation | Remediation

.EXAMPLE

PowerShell.exe -ExecutionPolicy ByPass -File <ScriptName>.ps1

.NOTES

VERSION     AUTHOR              CHANGE

1.0         Muhammad Zeeshan     Initial script creation

#>

Logging

$LogPath = "C:\Support\Zoom"

Start-Transcript -Path $LogPath\ZoomCleanup.log -Append -NoClobber

Variables

$CleanZoomTool = "C:\Support\Zoom\CleanZoom.exe"

Check to see if 'C:\Support\Zoom' exists

$CheckZoomFolder = Test-Path -Path "C:\Support\Zoom" -PathType Container

If 'C:\Support\Zoom' folder does not exist then create it

if ($CheckZoomFolder -eq $false) {

# Create folder

Write-Output "'C:\Support\Zoom' folder does not exist - creating it"

New-Item -Path "C:\Support" -Name "Zoom" -ItemType "Directory" -Force

}

else {

Write-Output "'C:\Support\Zoom' folder exists - continuing"

}

Check if CleanZoom.exe exists on the device

$CheckZoomClean = Test-Path -Path $CleanZoomTool -PathType "Leaf"

If CleanZoom.exe does not exist on the device - download from Zoom website and extract locally

if ($CheckZoomClean -eq $false) {

Write-Output "'C:\Support\Zoom\CleanZoom.exe' does not exist - downloading and extracting it"

Invoke-WebRequest -Uri "https://assets.zoom.us/docs/msi-templates/CleanZoom.zip" -OutFile "C:\Support\Zoom\CleanZoom.zip"

Expand-Archive -Path "C:\Support\Zoom\CleanZoom.zip" -DestinationPath "C:\Support\Zoom" -Force

Remove-Item -Path "C:\Support\Zoom\CleanZoom.zip" -Force

}

else {

Write-Output "'C:\Support\Zoom\CleanZoom.exe' exists - continuing"

}

try {

# Run CleanZoom.exe to remove any installed instances of Zoom client in User Profiles

Write-Output "Running CleanZoom.exe to remove Zoom instances from User Profile areas"

Start-Process -FilePath $CleanZoomTool -ArgumentList "/silent"

exit 0

}

catch {

Write-Output "CleanZoom.exe failed to run"

exit 1

}

Stop-Transcript

User's image

Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,510 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Crystal-MSFT 44,511 Reputation points Microsoft Vendor
    2024-05-13T07:16:40.03+00:00

    @Muhammad Zeeshan, Thanks for posting in Q&A. For the detection script, if we run it manually on the device, can it be success?

    Meanwhile, how did we configure the remediation settings.

    User's image

    If there's any update, feel free to let us know.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.