Oct 14 2022 06:36 AM
I would like to uninstall Silverlight SDK v 4.0.60310.0 using PowerShell. My script actually uninstalls only SILVERLIGHT and not the SDK. Tried using this and it looks like it should uninstall any Silverlight but it is not uninstalling in couple of Windows 10 computers. Any suggestions?
MrNetTek
# eddiejackson.net
# 7/15/2022
# free for public use
# free to claim as your own
$SoftwareName = "Silverlight"
$ItemProperties = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" | Select-Object DisplayName,UninstallString
foreach ($Item in $ItemProperties)
{
$DisplayName = $Item.DisplayName
$UninstallString = $Item.UninstallString
if($DisplayName -like "*$SoftwareName*")
{
Write-Host "$DisplayName : $UninstallString"
# Output: Microsoft Silverlight : MsiExec.exe /X{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}
# Always test this on a reference machine, first
# Sometimes the uninstall string is wrong, right from the vendor
# If you do run across an invalid uninstall string, fix it
# and hard code the uninstall string into your script
# Silverlight was missing the /qn
cmd.exe /c "$UninstallString /qn"
}
}
T