I have an Intune deployment I'm trying to build for Microsoft SSMS 21 and due to Microsoft's decision not to put the same Product version number on the SSMS.exe as the release version - (they had done for a few versions previously but not v21.x
), and sadly the Uninstall path to the product in the Registry doesn't look much better, it looks like it 'may' change with each subsequent version (currently HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\9349aeac) - I'd just like some consistency Microsoft ![]()
As a result i'm struggling with my deployment detection rule I'd like a consistent and reliable Detection rule to determine if the install has landed successfully.
I think I'd like to create a 'tag' in the Registry after the install has succeeded by way of a consistent Registry value that can be checked with my Detection rule.
So I have been investigating the PSADT Registry functions
I'm feeling slightly confused with how to use these 4 *-ADTRegistry* functions
I'm thinking creating HKLM:\SOFTWARE\CompanyName\SSMS 21\CurrentVersion with a value for the CurrentVersion of 21.5.14
N.B. I realise I'll need to perform this within the Post-Install section of my Invoke-AppDeployToolkit.ps1 script
And after the product has been successfully uninstalled, remove the Registry Key
e.g. HKLM:\SOFTWARE\CompanyName\SSMS 21
N.B. I realise I'll need to perform this within the Post-Uninstall section of my Invoke-AppDeployToolkit.ps1 script
Where should I start? ![]()
I have an idea that it's something like:
Post-Install:
Set-ADTRegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\CompanyName\SSMS 21' -Name 'CurrentVersion' -Type 'DWord' -Value '21.5.14'
Do I need to check if the path exists before assuming it will just create the Key?
and if I do how to check? Is it something like this?
if (!(Test-ADTRegistryValue -Key 'HKLM:\SOFTWARE\CompanyName\SSMS 21' -Name 'CurrentVersion')) {
# Set (create) Registry value for new install of SSMS 21.x
Set-ADTRegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\CompanyName\SSMS 21' -Name 'CurrentVersion' -Type 'DWord' -Value '21.5.14'
} else {
# Update Registry value if a newer version has been just been installed
if ((Get-ADTRegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\Company\SSMS 21' -Name 'CurrentVersion') -lt '21.5.14') {
Set-ADTRegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\CompanyName\SSMS 21' -Name 'CurrentVersion' -Type 'DWord' -Value '21.5.14'
}
}
What isn't covered by the above logic is if the Registry path HKEY_LOCAL_MACHINE\SOFTWARE\CompanyName\SSMS 21 doesn't exist what would happen?, but I can't seem to work out how to test for this ![]()
Post-Uninstall:
Remove-ADTRegistryKey -Key 'HKEY_LOCAL_MACHINE\Software\CompanyName\SSMS 21' -Recurse
Do I need the -Recurse switch?