Saturday, January 7, 2012

Removing old versions of Chrome using PowerShell

Google Chrome leaves older versions of itself on disk, which can cause useful vulnerability scanners such as the fantastic Secunia PSI to report Chrome as vulnerable although the older version is not in use.

To automatically remove older versions from the current user, run the following PowerShell one-liner.

dir ~\AppData\Local\Google\Chrome\Application | ? { $_ -match '\d+\.\d+\.\d+\.\d+' } | % { @{ File=$_; Version=(New-Object System.Version $_.Name) } } | sort -Descending Version | select -Skip 1 | % { del -fo -r $_.File.PSPath }

0 comments:

Post a Comment