This script will check wheter any version of MS Visio is installed and uninstall it.
It doesn’t require any Setup or source files as it will check the Uninstall string and use that one to uninstall.
For unattended silent uninstalls, an XML file will be created in the Temp folder depending on the installed version of Visio and will be used for the uninstall.
I have tested this script with following installed products and it worked every time without any issues:
Microsoft Office Visio Standard 2003
Microsoft Office Visio Professional 2003
Microsoft Office Visio Standard 2007
Microsoft Office Visio Professional 2007
Microsoft Visio Standard 2010
Microsoft Visio Professional 2010
Microsoft Visio Premium 2010
Microsoft Visio Standard 2013
Microsoft Visio Professional 2013
Microsoft Visio Standard 2016
Microsoft Visio Professional 2016
For your reference, the Product ID’s for the different Visio versions that have to be used in the XML are: VisPro
Visio Professional 2007
Visio Professional 2013
Visio Professional 2016
VisStd
Visio Standard 2007
Visio Standard 2013
Visio Standard 2016
How do I change the script to use it foor Project? I changed all the visio and vis text into project and proj but it doesn’t work… Powershell windows stops…
And how do I implement the script to do this for 200 computers?
Well I actually happen to have an uninstall script for all Ms Project versions from 2003 until 2013.
We didn’t have 2016 back then, but it shouldn’t be that hard to append to the script.
I’ve successfully uninstalled approx. 350 Microsoft Projects.
For your information, there are other ways to accomplish this as well. Like for instance using the Offscrub.vbs files (which I use for my Office upgrades).
But I seriously had a 100% success rate with my script which basically does a clean uninstall like you would do manually.
To answer your question…
Project 2003 and Project 2007 (all versions) have a Product Code that can be used with msiexec to uninstall it.
So what I did is get the Product Code like this:
$ProjPro2003 = (Get-InstalledApplication -Name "Microsoft Office Project Professional 2003").ProductCode
$ProjStd2003 = (Get-InstalledApplication -Name "Microsoft Office Project Standard 2003").ProductCode
$ProjPro2007 = (Get-InstalledApplication -Name "Microsoft Office Project Professional 2007").ProductCode
$ProjStd2007 = (Get-InstalledApplication -Name "Microsoft Office Project Standard 2007").ProductCode
Then with some if statements (if installed) uninstalled it with: Execute-MSI -Action 'Uninstall' -Path $ProductKey
For Project 2010 and Project 2013 I userd the XML files like for Visio.
Procuct Code for Microsoft Project Standard 2010 and 2013: ProjStd
Procuct Code for Microsoft Project Professional 2010 and 2013: ProjPro
We have this version:
IdentifyingNumber : {90150000-003B-0000-0000-0000000FF1CE}
Name : Microsoft Project Professional 2013
Vendor : Microsoft Corporation
Version : 15.0.4569.1506
Caption : Microsoft Project Professional 2013
From registry:
MsiExec.exe /X{90150000-003B-0000-0000-0000000FF1CE}
Changed the script.
$PrjPro2013 = Get-InstalledApplication -Name “Microsoft Project Professional 2013” -Exact | where {$_.UninstallSubkey -eq “Office15.ProjPRO”}
It starts and finds Project, no .xml creation…
Last results:
[12-21-2016 08:25:19.465] [Pre-Uninstallation] [Get-InstalledApplication] :: Found installed application [Microsoft Project Professional 2013] version [15.0.4569.1506] using exact name matching for search term [Microsoft Project Professional 2013].
[12-21-2016 08:25:19.490] [Pre-Uninstallation] [Get-InstalledApplication] :: Found installed application [Microsoft Project Professional 2013] version [15.0.4569.1506] using exact name matching for search term [Microsoft Project Professional 2013].
[12-21-2016 08:25:19.549] [Post-Uninstallation] [Exit-Script] :: Microsoft Project Uninstall Uninstallation completed with exit code [0].
[12-21-2016 08:25:19.553] [Post-Uninstallation] [Exit-Script] :: ------------------------------------------------------------------
Runned the script.
It went a little further than mine.
.XML file is created
.LOG is created
[12-21-2016 12:47:20.126] [Pre-Uninstallation] [Get-InstalledApplication] :: Found installed application [Microsoft Project Profess
ional 2013] version [15.0.4569.1506] using exact name matching for search term [Microsoft Project Professional 2013].
[12-21-2016 12:47:20.141] [Pre-Uninstallation] [Get-InstalledApplication] :: Found installed application [Microsoft Project Profess
ional 2013] version [15.0.4569.1506] using exact name matching for search term [Microsoft Project Professional 2013].
Strange.
I remember testing it with “Microsoft Visio Standard 2016” and “Microsoft Visio Professional 2016” back then.
It worked without problems.
Does it work when you run the uninstall string from CMD manually?
I suggest you do the following to troubleshoot:
In Powershell ISE Open
\AppDeployToolkit\AppDeployToolkitMain.ps1
Deploy-Application.ps1
Run AppDeployToolkitMain.ps1 from within ISE in order to load all functions, like it would if deployed via SCCM.
That way you can use all the cmdlets and functions from the toolkit.
I typed a lot more steps but this freaking forum doesn’t let me post it. It says it’s forbidden.
Probably because I included some cmdlets
Hi Aldin, I’m having some problems recreating the Project uninstaller is there any way you can share it like you did the Visio, cause I’m getting that it access the config.xml file and I’ve changed locations and still doesn’t help. Also, having some issues with the Visio for 2016 it works for 2013 but get Error Record: Message: You cannot call a method on a null-valued expression.
InnerException:
FullyQualifiedErrorId: InvokeMethodOnNull
PositionMessage: At C:\Windows\ccmcache\g\Deploy-Application.ps1:305
char:75
As for that error you’re getting for Visio.
The error basically means: You are trying to do something (method) with a value, but the value doesn’t exist.
The method in that error is .trim
Basically, this part is blank, so you can’t trim it: (VisPro2016.UninstallString -split (“”))
did you change line 305?
It should be this: $params = (($VisPro2016.UninstallString -split ('"'))[2]).trim() + " /config $ConfigXML_Pro"
In order to troubleshoot this, do the following:
Open Powershell ISE as admin
Open file: \AppDeployToolkit\AppDeployToolkitMain.ps1
Run that file. This will load all functions from PsADT
Open Deploy-Application.ps1 and troubleshot step by step
In your case, execute line 175, which is this: $VisPro2016 = Get-InstalledApplication -Name "Microsoft Visio Professional 2016" -Exact | where {$_.UninstallSubkey -eq "Office16.VISPRO"}
See if that returns any value because this is where it goes wrong.
Hello, I tried to use this same script, changing it to Office Standard 2013, but presented the error below:
<code>---------------------------
Setup Error
Can not find the specified config.xml file. C: \ Program Files \ Common Files \ Microsoft Shared \ OFFICE14 \ Office Setup \ Controller \ "C: \ windows \ Logs \ Software \ OfficeSilentUninstallConfig.xml"
OK
---------------------------</code>
In my case, I need to verify that the machine is running Office x86 or x64 first and uninstall Lync 2013 and also Office 2010 if it is x64. How can I do it?
Any chance you messed up the quotes?
I see weird quotes in your script when I open it.
some are straight quotes while others are curved quotes.
Make them all straight.