Avatar of Dom Gaudioso
Dom Gaudioso
 asked on

I need help creating a [powershell] script that can uninstall silently MS Visio all versions from Win 7 computers.

I need help creating a script that can uninstall silently MS Visio - all versions - from Win 7 computers.  Thanks
Powershell

Avatar of undefined
Last Comment
Shaun Vermaak

8/22/2022 - Mon
Shaun Vermaak

$app = Get-WmiObject -Class Win32_Product | Where-Object { 
    $_.Name -match "Visio" 
}

$app.Uninstall()

Open in new window

Dom Gaudioso

ASKER
Hi Shaun.  Thank you very much for the reply.  I already had this script, which works in Win 10 but not Win 7.   Any clues why?


Set-ExecutionPolicy RemoteSigned
Set-ExecutionPolicy Unrestricted
$app = Get-WmiObject -Class Win32_Product | Where-Object {
    $_.Name -match "visio"
}

$app.Uninstall()
ASKER CERTIFIED SOLUTION
Shaun Vermaak

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Dom Gaudioso

ASKER
Do you mean use Powershell v5+ to write the script?  Or Powershell v5+ needs to be installed on the target PC?   Thank you very much fop the reply.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Dom Gaudioso

ASKER
Hi Shaun, I have the version 5.1 on my Win 10 computer, so I would need to install it on the Win 7 computers as well for the uninstall routine to work?  

Here is the result of my version command on my PC:

PS H:\> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14393  206    

Thank you for the reply.
Shaun Vermaak

Are you running script remotely or executing it on remote computers via GPO etc?
Dom Gaudioso

ASKER
executing via BMC Footprint console - thank you
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Shaun Vermaak

Guess it is running directory on the client then, so yes PS 5 required on the client. You can also run this with Invoke-Command
Dom Gaudioso

ASKER
Thank you LVL - this works for now...
Shaun Vermaak

Glad we could help.

@OP, experts and future visitors:
Please remember to endorse my, or any other expert's comments that you found helpful by clicking on the "Thumb's Up" button

Read more on endorsements
https://www.experts-exchange.com/discussions/218503/What-are-Endorsements.html
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck