Remove registry key based on substring value
hi!
i try upgrade flash player plugin using sccm error in installer exist. fistr must remove registry subkeys thath contain substring "adobe flash player 10 plugin" in [hkey_classes_root\installer] . substring must more one.
i try create scritp using function mentioned in blog post https://blogs.technet.com/b/heyscriptingguy/archive/2012/05/11/use-powershell-to-enumerate-registry-property-values.aspx?redirected=true conduction psdrive
i try create script
1. create new psdrive hkey_classes_root -> new-psdrive -name hkcr -psprovider registry -root hkey_classes_root
2. get-childitem recurse -> get-childitem -path hkcr:\installer -recurse
3. substring subkeys -> foreach-object { get-itemproperty $_.pspath } | get-registrykeypropertiesandvalues
but path must give function?
4. filter substring -> how ?
5. remove key if substring equal -> how?
anybody can me?
regards
wojciech sciesinski
hi
i've created script find entry text pattern , remove parrent key.
try { $keys=get-childitem hkcr:\installer -recurse -erroraction stop | get-itemproperty -name productname -erroraction silentlycontinue } catch { new-psdrive -name hkcr -psprovider registry -root hkey_classes_root -erroraction silentlycontinue | out-null $keys=get-childitem hkcr:\installer -recurse | get-itemproperty -name productname -erroraction silentlycontinue } { foreach ($key in $keys) { if ($key.productname -like "*flash*plugin") { remove-item $key.pspath -force -recurse } } }
maybe helpfull somebody.
do have idea registry search optimization?
wojciech sciesinski
Windows Server > Windows PowerShell
Comments
Post a Comment