Recently, several programs have been installed with GPOs, how to determine whether the installation is successful?
There's a simple script, like I'm judging if TightVNC is installed on all Win7 systems.
$a =get-adcomputer -filter{operatingsystem -like "*7*"} -properties operatingsystem | select name, operatingsystemforeach ($b in $a) {if (test-connection - computername $b. Name -count 1 -quiet) {$b. nameinvoke-command -computername $ b.name {if ([system.intptr]::size -eq 4) { "32-bit" get-itemproperty hklm:\ software\microsoft\windows\currentversion\uninstall\* | where-object{$_.displayname -eq " TightVNC "} | select-object displayname, displayversion, publisher, installdate } else { "64-bit" get-itemproperty hklm:\software\microsoft\windows \currentversion\uninstall\*,hklm:\software\wow6432node\microsoft\windows\currentversion\uninstall\* | Where-Object{$_.displayname -eq "TightVNC"} | select-object displayname, displayversion, publisher, installdate }}}}
Note the point:
Do not use WMI when querying installed programs; If I use Get-wmiobject-class win32_product, I can get the same information, but at a speed dozens of times times slower than the registry query;
When querying the registry, differentiate between 32-bit and 64-bit systems, because we can install 32-bit programs on 64-bit systems
This article is from the "Mapo Tofu" blog, please be sure to keep this source http://beanxyz.blog.51cto.com/5570417/1677123
After the GPO installer checks whether the installation was successful