Sometime before I have received one crazy request from the team, They want to uninstall 2 plugin apps from the production machine. but the condition is if the machine name ends with letter "D" then only start uninstallation from the machine, else leave the applications as it is.
In the PowerShell script first, we have to determine the computer name and then check if the machine name is ending with the letter D and finally we have to start the uninstallation from the target machine.
so here are 3 requirement block has to write in the script.
in the Uninstallation program name, we have used the uninstallation string from registry - Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
if the application is x64 bit version then we have to collect the uninstallation string from the registry path -Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall.