- DisplayName: the name of the application
- UninstallString: the command line to uninstall the application.
use strict;
use Win32::TieRegistry;
my $machine = 'localhost'; # make sure the RemoteRegistry services is up
# and the script is executed with user within
# administrator group.
my $register = 'HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows'.
'/CurrentVersion/Uninstall';
$register = "//$machine/$register";
$Registry->Delimiter("/");
my $remoteKey = $Registry->{$Register};
if (defined $remoteKey) {
foreach my $appKey ( $remoteKey->SubKeyNames ) {
my $DisplayName = $Registry->{"$Register/$appKey/DisplayName"};
my $UninstallString = $Registry->{"$Register/$appKey/UninstallString"};
if (defined $UninstallString && defined $DisplayName) {
$app{$DisplayName} = $UninstallString;
}
}
}
open LOG, ">$0.txt";
foreach my $appName (sort keys %app) {
print LOG "$appName, $app{$appName}\n";
}
close LOG;
Usually, there are two kinds of command line, the first one is an executable binary and customized MSI script (the command line starts with msiexec.exe). If you happen to encounter the later one, you are in luck, if not, pray that the baboon put in the quiet mode in the binary.
If the uninstallation string uses msiexec.exe, just put in /quiet at the back of the string to launch quiet installation.
No comments:
Post a Comment