{"id":6199,"date":"2022-09-27T22:11:37","date_gmt":"2022-09-27T22:11:37","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=6199"},"modified":"2024-06-13T02:56:30","modified_gmt":"2024-06-13T02:56:30","slug":"intune-proactive-remediation-to-uninstall-software","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/intune-proactive-remediation-to-uninstall-software","title":{"rendered":"Intune proactive remediation to Uninstall Software"},"content":{"rendered":"\n<p><strong>Remotely Uninstall<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Invoke-Command -Computername $Computers {Get-Package -Name \"*SilverLight*\" | Uninstall-Package}<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Locally Uninstall<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">Get-Package -Name \"*SilverLight*\" | Uninstall-Package<\/code><\/pre>\n\n\n\n<p>L<strong>ocation ( Make sure you are licensed to use )&nbsp;<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"420\" src=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2022\/09\/img_633374f40d9b5.png\" alt=\"\" class=\"wp-image-6200 img-responsive\" srcset=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2022\/09\/img_633374f40d9b5.png 502w, https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2022\/09\/img_633374f40d9b5-300x251.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"348\" height=\"210\" src=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2022\/09\/img_6333754c1c94c.png\" alt=\"\" class=\"wp-image-6202 img-responsive\" srcset=\"https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2022\/09\/img_6333754c1c94c.png 348w, https:\/\/pariswells.com\/blog\/wp-content\/uploads\/2022\/09\/img_6333754c1c94c-300x181.png 300w\" sizes=\"auto, (max-width: 348px) 100vw, 348px\" \/><\/figure>\n\n\n\n<p><strong>Detect<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$SoftwareName = \"*Silverlight*\"\n\n$ItemProperties = Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*\" | Where Displayname -like \"*$SoftwareName*\"\n$ItemProperties32 = Get-ItemProperty \"HKLM:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*\" | Where Displayname -like \"*$SoftwareName*\"\n\nif ($ItemProperties -Or $ItemProperties32) {\n    Write-Host \"$SoftwareName found\"\n    Exit 1\n} Else {\n    Write-Host \"$SoftwareName Not found\"\n    Exit 0\n}\n\n\n catch{\n    $errMsg = $_.exeption.essage\n    Write-Output $errMsg\n }<\/code><\/pre>\n\n\n\n<p>Remmediate<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\"># MrNetTek\n# eddiejackson.net\n# 7\/15\/2022\n# free for public use\n# free to claim as your own\n \n$SoftwareName = \"*Silverlight*\"\n \n$ItemProperties = Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*\" | Select-Object DisplayName,UninstallString\n$ItemProperties32 = Get-ItemProperty \"HKLM:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*\" | Where Displayname -like \"*$SoftwareName*\"\n\nforeach ($Item in $ItemProperties)\n    {\n        $DisplayName = $Item.DisplayName\n        $UninstallString = $Item.UninstallString\n\t\t$PSChildName = $Item.PSChildName\n        if($DisplayName -like \"*$SoftwareName*\")\n            {\n\t\t\t\tWrite-Host \"MsiExec.exe \/X$PSChildname \/qn \/norestart\"\n                # Output: Microsoft Silverlight : MsiExec.exe \/X{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}\n                # We dont use $UninstallString as software Like Forticlient has MsiExec.exe \/I ( Install for Uninstall String??? )\n                # Always test this on a reference machine, first\n                # Sometimes the uninstall string is wrong, right from the vendor\n                # If you do run across an invalid uninstall string, fix it\n                # and hard code the uninstall string into your script\n                # Silverlight was missing the \/qn\n                cmd.exe \/c \"MsiExec.exe \/X$PSChildname \/qn \/norestart\"\n            }\n    }\n\t\n\nforeach ($Item in $ItemProperties32)\n    {\n        $DisplayName = $Item.DisplayName\n        $UninstallString = $Item.UninstallString\n\t\t$PSChildName = $Item.PSChildName\n        if($DisplayName -like \"*$SoftwareName*\")\n            {\n\t\t\t\tWrite-Host \"MsiExec.exe \/X$PSChildname \/qn \/norestart\"\n                # Output: Microsoft Silverlight : MsiExec.exe \/X{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}\n                # We dont use $UninstallString as software Like Forticlient has MsiExec.exe \/I ( Install for Uninstall String??? )\n                # Always test this on a reference machine, first\n                # Sometimes the uninstall string is wrong, right from the vendor\n                # If you do run across an invalid uninstall string, fix it\n                # and hard code the uninstall string into your script\n                # Silverlight was missing the \/qn\n                cmd.exe \/c \"MsiExec.exe \/X$PSChildname \/qn \/norestart\"\n            }\n    }<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Remotely Uninstall Locally Uninstall Location ( Make sure you are licensed to use )&nbsp; Detect Remmediate<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2837,4004,4005,971],"class_list":["post-6199","post","type-post","status-publish","format-standard","hentry","category-research","tag-intune","tag-proactive-remediation","tag-silverlight","tag-uninstall"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=6199"}],"version-history":[{"count":12,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6199\/revisions"}],"predecessor-version":[{"id":7991,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6199\/revisions\/7991"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=6199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=6199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=6199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}