tags:

views:

34

answers:

2

Is there a way in Powershell to query the object Property Page Details to verify if the Copyright, Product name and File version are not empty. I want to be able to query this info when I'm looking for viruses

+1  A: 

In PowerShell v2, the FileVersionInfo is attached to the object you get when you 'dir' a dll or exe e.g.:

PS\> Get-ChildItem C:\Windows\notepad.exe | Format-List VersionInfo


VersionInfo : File:             C:\Windows\notepad.exe
              InternalName:     Notepad
              OriginalFilename: NOTEPAD.EXE.MUI
              FileVersion:      6.1.7600.16385 (win7_rtm.090713-1255)
              FileDescription:  Notepad
              Product:          Microsoft® Windows® Operating System
              ProductVersion:   6.1.7600.16385
              Debug:            False
              Patched:          False
              PreRelease:       False
              PrivateBuild:     False
              SpecialBuild:     False
              Language:         English (United States)

Query this information like so:

gci c:\windows\*.exe | ? {$_.VersionInfo.LegalCopyright -notmatch 'Microsoft'} |
    fl VersionInfo

Note that ? is an alias for the Where-Object cmdlet.

Keith Hill
A: 

Thank you for your time, I will get PSv2 installed and try it.

Gary Mitchell