I need some help with a school project ! Plz help!

I’m trying to write a script to uninstall the current version of zoom of my computer and install the new version using power shell . The install work fine but the uninstall is a different story ! Could someone look at it and give me some ideas ?

This is what I got so far :

# Uninstall Zoom

# Define Zoom product name
$zoomProductName = "Zoom"

# Get Zoom uninstallation information
$uninstallInfo = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like "*$zoomProductName*" }

if ($uninstallInfo) {
    $uninstallCommand = $uninstallInfo.UninstallString
    Write-Host "Uninstalling Zoom..."
    Start-Process -FilePath "msiexec.exe" -ArgumentList "/x $uninstallCommand /quiet" -Wait
    Write-Host "Zoom has been uninstalled."
} else {
    Write-Host "Zoom is not installed on this machine."

# Download Zoom installer
$zoomInstallerUrl = "https://zoom.us/client/latest/ZoomInstaller.exe"
$zoomInstallerPath = "$env:TEMP\ZoomInstaller.exe"
Write-Host "Downloading Zoom installer..."
Invoke-WebRequest -Uri $zoomInstallerUrl -OutFile $zoomInstallerPath

# Install Zoom
Write-Host "Installing Zoom..."
Start-Process -FilePath $zoomInstallerPath -ArgumentList "/install /quiet" -Wait

# Cleanup
Remove-Item -Path $zoomInstallerPath
Write-Host "Zoom installation completed."

Thanks ,

Welcome to the forum. :wave:t3:

Before we proceed … please go back, edit your question once again and fix the formatting of your ocde.

When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

How to format code in PowerShell.org 1 <---- Click :point_up_2:t4: :wink:

( !! Sometimes the preformatted text button hides behind the settings gear symbol. :wink: )

We usually try to avoid assisting with those as the first port of call should be your teacher, tutor or supervisor.

Regardless of that here are some general tips or comments on your code:

What exactly does that mean? Doesn’t it work? Did you get errors? If “yes” you should share them here along with your code (formatted as code as well please.)

And BTW: Please stop adding spaces in front of punctuation marks. :wink:

How did you install Zoom? Is it a user installation? Do you want to uninstall the version from the currently logged on user?

1 Like


Thanks for the tip on how to edit the format of the code. Lets say currently the user has Zoom installed but its an older version and I want the powershell to uninsnstall the curent version and install the latest. The error that i’m getting is that “Zoom is not installed on this machine.” . I think I’m mesing up the path somehow!

I chose this as a final project because I thought it would be simple, but I had more issues with this than any other project I worked on so far. Unfortunately asking as teacher or tutor is out of an option!

Sorry if that sounds picky, but do you run this code as the user who installed zoom?

If that’s the case you should (re-)read the blog post about not to use Win32_Product WMI class I linked above to learn how to determine installed products and their uninstallstring.

If you want to uninstall a Zoom user installation from another profile you will get issues.

Is that the error you’re actually creating yourself with your Write-Host command? Do you actually get errors?

Hint: There is a better cmdlet to uninstall a package

@Olaf No error but it won’t uninstall zoom .

Please answer all questions!

So again …

Since we cannot see your screen or read your mind you will have to help us helping you.

Did you read the blog post I linked above?

Have you tried to determine the installed Zoom with another approach than using the WMI class Win32_Product?

Yes, I run the code as the user that installed zoom and no unfortunately I haven’t had time to read the post you posted above . Also I don’t know another way to determine the installed zoom . I apologize but I’m just trying to learn and I don’t know much about PowerShell. I’m taking the class to get a better understanding.


@neemobeer How would I do that ? What a better way ?

It’s not hat much … it does not take that long to read … :man_shrugging:t3: … and it has the explanation why you should not use the WMI class Win32_Product anymore and how you get the information with a better approach. We cannot read or learn for you. You will have to do that by yourself. :man_shrugging:t3:

We all have been there once.

1 Like