PowerShell script to help uninstall SQL Server 2008 R2 Evaluation Edition

How To Powershell SQL
PowerShell script to help uninstall SQL Server 2008 R2 Evaluation Edition

Get-ChildItem HKLM:SOFTWAREMicrosoftWindowsCurrentVersionUninstall | 
select @{Name=’Guid’;Expression={$_.PSChildName}}, @{Name=’Disp’;Expression={($_.GetValue(“DisplayName”))}} | 
where-object {$_.Disp -ilike “*SQL*R2*”} | 
where-object {$_.Guid -like ‘{*’} | 
% {“rem ” + $_.Disp; ‘msiexec /x “‘ + $_.Guid + ‘”‘; ”} > uninstallR2.bat

The script is quite straight forward, it just lists everything in the uninstall bit of the registry, gets the DisplayName values out, filters them, and outputs the results in a few lines for the batch file. Nothing amazingly complicated, but useful for getting through the list quickly.


Big thanks to Aaron for working out what was required for the uninstall, and Aaron Nelson 


(Visited 11 times, 1 visits today)