using WindowsInstaller;
Installer wi = (Installer)Activator.CreateInstance(Type.GetTypeFromProgID("WindowsInstaller.Installer"));
StringList sl = wi.Products;
foreach (string pn in sl)
{
Console.WriteLine(wi.get_ProductInfo(pn, "ProductName"));
}
Installer wi = (Installer)Activator.CreateInstance(Type.GetTypeFromProgID("WindowsInstaller.Installer"));
StringList sl = wi.Products;
foreach (string pn in sl)
{
Console.WriteLine(wi.get_ProductInfo(pn, "ProductName"));
}
get_ProductInfo(pruduct, attribute) 에서 사용할수 있는 속성(attribute) 값은,
"HelpLink"
"HelpTelephone"
"InstallDate"
"InstallLocation"
"InstalledProductName"
"InstallSource"
"LocalPackage"
"ProductID"
"Publisher"
"PackageName"
"RegCompany"
"RegOwner"
"URLInfoAbout"
"URLUpdateInfo"
"VersionMinor"
"VersionMajor"
"VersionString"
"Transforms"
"Language"
"AssignmentType"
"PackageCode"
"PackageName"
"ProductIcon"
"ProductName"
"Version"
"InstanceType"
"HelpTelephone"
"InstallDate"
"InstallLocation"
"InstalledProductName"
"InstallSource"
"LocalPackage"
"ProductID"
"Publisher"
"PackageName"
"RegCompany"
"RegOwner"
"URLInfoAbout"
"URLUpdateInfo"
"VersionMinor"
"VersionMajor"
"VersionString"
"Transforms"
"Language"
"AssignmentType"
"PackageCode"
"PackageName"
"ProductIcon"
"ProductName"
"Version"
"InstanceType"
위의 COM 개체를 사용할려면, Microsoft Windows Installer Object Library 를 Interop 해와야 합니다. 실행을 하면 다음처럼 프로그램 목록이 나옵니다.
Microsoft ASP.NET 2.0 AJAX Extensions 1.0
Compatibility Pack for the 2007 Office system
Microsoft Office PowerPoint Viewer 2007 (Korean)
Microsoft .NET Compact Framework 1.0 SP3 Developer
Windows Live Messenger
MSXML 6 Service Pack 2 (KB954459)
Microsoft .NET Framework 3.0 Service Pack 2
.......
Compatibility Pack for the 2007 Office system
Microsoft Office PowerPoint Viewer 2007 (Korean)
Microsoft .NET Compact Framework 1.0 SP3 Developer
Windows Live Messenger
MSXML 6 Service Pack 2 (KB954459)
Microsoft .NET Framework 3.0 Service Pack 2
.......
이게 필요했던 이유가 문자열 값중 "MsiExec.exe /I{9CAEFF6D-8A27-48F4-8340-509F6A248CAD}" 실행경로를 제어판을 이용하지 않고 프로그램을 삭제하기 위해서 였습니다.
이것보다 더 좋은 방법이 있을까요?...
아시는 분이라면 댓글 부탁드립니다.
댓글 없음:
댓글 쓰기