I want to do this using the win32_product wmi class.
I need a script
I do not seem to be working on ATMs correctly:
$ count = 0 $ Products = get -wmiobject -class "Win32_Product" foreach ($ product in product) {if ($ product.InstallState -q5) {count ++}} write-host number
Be careful! By using WMI's So what is a better (secure) solution? Mark Carter, Guest column Hey, Scripting Boy! / Em> The blog above takes the first volley, provides custom powershiffunction, returns to my system, so only several entries will return as Win32_Product invoices. In addition to this, it is a lot of code (3 dozen lines Either in the comment on your post, however, knutkj gives a very small version which does the same thing: But as I said, it is: do not provide the full list but this is a start. Later commented Nick W told that there are actually 3 registry paths of interest, although not everybody in every system can be present. Apart from this, when looking at those 3 routes, some have to filter some additional. By combining the two of them, adding to some more output fields and making the code run in strict mode, I came to this simple solution: Win32_Product
class, that question and previous 2 replies has not been advised for this purpose. In short: Using Win32_Product not is a useless query because it refers to Microsoft's side effects, "[ This] ... a continuation check of the installed packages, launches confirmation and installation . "
Get-ChildItem -Path HKLM: \ Microsoft Windows CurrentVersion \ uninstall software | Received-itemproperty | Sort-object-property displayname Choose - object-property display, display version, installer
function (HKLM: \ Microsoft \ Windows \ CurrentVersion \ uninstall \ "Software \", "HKCU: \ Software \ Microsoft \ Windows \ CurrentVersion \ Uninstall \", "HKLM: \ Software \ Wow6432Node \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ ") Go-ChildItem ($ regLocations | Where {Test Path $ _}) | Received-itemproperty | Where {(Member-Input Object $ _- name displayed) -and $ _. DisplayName -ne $ tap) -And ((Member-Input Object $ _- NamesCompanyant) -or $ _. SystemComponent -ne "1 ") -And ((Member-Input Object $ _-name ParentKeyName) -or $ _ParentKeyName -q $ tap)} | Sort DisplayName | Select DisplayName, DisplayVersion, Publisher, InstallLocation, InstallDate, URLInfoAbout}
Comments
Post a Comment