Skip to content

Commit 39239ba

Browse files
authored
Update to latest version 👍
1 parent f062875 commit 39239ba

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

Powershell/Remove SCOM Agent/Remove_SCOM_Agent.ps1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,16 @@ Function Remove-SCOMAgent {
125125

126126
# Check Installed Agent Version if available (GUIDs obtained from the 'ProductCode' property of the MSI installer)
127127
$productGUIDs = @(
128-
[pscustomobject]@{Version='SCOM 2007'; GUID='{E7600A9C-6782-4221-984E-AB89C780DC2D}'},
129-
[pscustomobject]@{Version='SCOM 2007R2'; GUID='{25097770-2B1F-49F6-AB9D-1C708B96262A}'},
130-
[pscustomobject]@{Version='SCOM 2012'; GUID='{5155DCF6-A1B5-4882-A670-60BF9FCFD688}'},
131-
[pscustomobject]@{Version='SCOM 2012R2'; GUID='{786970C5-E6F6-4A41-B238-AE25D4B91EEA}'},
132-
[pscustomobject]@{Version='SCOM 2016'; GUID='{742D699D-56EB-49CC-A04A-317DE01F31CD}'},
133-
[pscustomobject]@{Version='SCOM 1801/1807'; GUID='{EE0183F4-3BF8-4EC8-8F7C-44D3BBE6FDF0}'},
134-
[pscustomobject]@{Version='SCOM 2019'; GUID='{CEB9E45B-2152-4C10-A022-0825B53B632F}'},
135-
[pscustomobject]@{Version='SCOM 2022'; GUID='{382C3EC9-20AD-4E09-A6D6-8E34CF3E0586}'}
136-
#[pscustomobject]@{Version='Azure'; GUID=''} # This product code changes every time they release an update, which is often. So we'll try to remove a different way
128+
[pscustomobject]@{Version='SCOM 2007'; GUID='{E7600A9C-6782-4221-984E-AB89C780DC2D}'}, # Version 6.0.x.x
129+
[pscustomobject]@{Version='SCOM 2007R2'; GUID='{25097770-2B1F-49F6-AB9D-1C708B96262A}'}, # Version 6.1.x.x
130+
[pscustomobject]@{Version='SCOM 2012'; GUID='{5155DCF6-A1B5-4882-A670-60BF9FCFD688}'}, # Version 7.0.x.x
131+
[pscustomobject]@{Version='SCOM 2012R2'; GUID='{786970C5-E6F6-4A41-B238-AE25D4B91EEA}'}, # Version 7.1.x.x
132+
[pscustomobject]@{Version='SCOM 2016'; GUID='{742D699D-56EB-49CC-A04A-317DE01F31CD}'}, # Version 8.0.x.x
133+
[pscustomobject]@{Version='SCOM 1801/1807'; GUID='{EE0183F4-3BF8-4EC8-8F7C-44D3BBE6FDF0}'}, # Version 8.0.13053.0/8.0.13067.0
134+
[pscustomobject]@{Version='SCOM 2019'; GUID='{CEB9E45B-2152-4C10-A022-0825B53B632F}'}, # Version 10.19.x.x
135+
[pscustomobject]@{Version='SCOM 2022'; GUID='{382C3EC9-20AD-4E09-A6D6-8E34CF3E0586}'}, # Version 10.22.x.x
136+
# The Azure MMA product code changes every time they release an update, which is often, so we can't have a static GUID here, is released as version 10.20.x.x
137+
[pscustomobject]@{Version='Azure LA'; GUID=(Get-ChildItem -Path "Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" -Recurse -ErrorAction SilentlyContinue | Get-ItemProperty | Where-Object {($_.DisplayName -like "*Microsoft Monitoring Agent*") -and ($_.DisplayVersion -like "10.20*")}).PSChildName}
137138
)
138139

139140
# Set installed agent version defaults
@@ -253,8 +254,7 @@ InstalledOn: $installDateTime
253254
Write-Output "`nCleaning up registry entries"
254255

255256
# Remove DLL registrations and additional registry keys
256-
# $addtionalRegistryKeys = Get-Content $PSScriptRoot\RegistryKeys.txt
257-
# $addtionalRegistryKeys | ForEach-Object { Remove-Item -Path Registry::$_ -Force -Verbose -Recurse -ErrorAction SilentlyContinue }
257+
## Comment this line out if you don't want to do this
258258
$RegistryKeys | ForEach-Object { Remove-Item -Path Registry::$_ -Force -Verbose -Recurse -ErrorAction SilentlyContinue }
259259

260260
# Remove Control Panel Options

0 commit comments

Comments
 (0)