PoshCode Logo PowerShell Code Repository

Antivirus path by Olivia Wild 13 months ago
embed code: <script type="text/javascript" src="http://PoshCode.org/embed/6246"></script>download | new post

This script returns a path where antivirus has been installed. It doesn’t use WMI (thanks a lot to greg zakharov for this trick).

  1. Get-ChildItem Registry::HKCR\CLSID | ForEach-Object {
  2.   $x = (Get-ItemProperty 'Registry::HKCR\Component Categories\*' |
  3.   Where-Object {$_ -match 'antivirus'}).PSChildName
  4. }{
  5.   if ((Get-ChildItem "$($_.PSPath)\Implemented Categories" -ea 0).PSChildName -eq $x) {
  6.     Split-Path (Get-ItemProperty "$($_.PSPath)\InprocServer32").'(default)'
  7.     break
  8.   }
  9. }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

Remember me