Hi all,
I was not able to find a easy way to determine installed verison of EMET via script. If you can guide me in the right direction, this would help a lot.
Many thanks
Sam
Technology Tips and News
Hi all,
I was not able to find a easy way to determine installed verison of EMET via script. If you can guide me in the right direction, this would help a lot.
Many thanks
Sam
This is probably not the right forum for scripting questions and you didn't specify which script you (want to) use... Below you can find some examples...
If you use VBscript you could use WMI and query the class Win32_Product:
strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set colSoftware = objWMIService.ExecQuery _ ("Select * from Win32_Product where Name like '%EMET%'") For Each objSoftware in colSoftware Wscript.Echo "Name: " & objSoftware.Name Wscript.Echo "Version: " & objSoftware.Version Next
This method is not advisable because the class isn't optimized for queries and therefore the query takes a long time!
You can also use the Windows Installer object:
Option Explicit ' Connect to Windows Installer object Dim installer Set installer = Wscript.CreateObject("WindowsInstaller.Installer") Dim product, products Set products = installer.Products For Each product In products if instr(1,installer.ProductInfo(product, "InstalledProductName"), "EMET", vbTextCompare) > 0 AND instr(1,installer.ProductInfo(product, "Publisher"), "Microsoft", vbTextCompare) > 0 then Wscript.Echo installer.ProductInfo(product, "InstalledProductName") Wscript.Echo installer.ProductInfo(product, "VersionString") End If Next Set products = Nothing Set installer = Nothing Wscript.Quit 0
This method enumerates all the products but be aware that you should also check the installstate because the installstate of a product also can be advertised.
You can also use powershell to enumerate the uninstall registry keys but you have take into account that the results may be different on a 64-bit Windows and the bitness of the powershell proces:
gci "hklm:\software\microsoft\windows\currentversion\uninstall" | foreach { gp $_.PSPath } | select DisplayVersion,DisplayName | where { $_.DisplayName -match "^EMET*" }
You can also install and use the
Windows Installer PowerShell Module and use this command:
get-msiproductinfo | where { $_.Name -like '*EMET*' } | select ProductName,ProductVersion | format-list
On the internet you can find a lot of information about your question. For instance I found these pages: