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

Dom Gaudioso
Dom Gaudioso used Ask the Experts™
on
I need help creating a script that can uninstall silently MS Visio - all versions - from Win 7 computers.  Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Shaun VermaakTechnical Specialist
Awarded 2017
Distinguished Expert 2018

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

$app.Uninstall()

Open in new window

Author

Commented:
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()
Technical Specialist
Awarded 2017
Distinguished Expert 2018
Commented:
Install Powershell v5+
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Author

Commented:
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.

Author

Commented:
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 VermaakTechnical Specialist
Awarded 2017
Distinguished Expert 2018

Commented:
Are you running script remotely or executing it on remote computers via GPO etc?

Author

Commented:
executing via BMC Footprint console - thank you
Shaun VermaakTechnical Specialist
Awarded 2017
Distinguished Expert 2018

Commented:
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

Author

Commented:
Thank you LVL - this works for now...
Shaun VermaakTechnical Specialist
Awarded 2017
Distinguished Expert 2018

Commented:
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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial