Powershell中是否可以查询对象“属性页面详细信息”以验证“版权”,“产品名称”和“文件版本”是否为空。寻找病毒时,我希望能够查询此信息
最佳答案
在PowerShell v2中,将FileVersionInfo附加到当您“dir”一个dll或exe时获得的对象,例如:
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)
像这样查询此信息:
gci c:\windows\*.exe | ? {$_.VersionInfo.LegalCopyright -notmatch 'Microsoft'} |
fl VersionInfo
请注意,
?
是Where-Object cmdlet的别名。
关于powershell - Powershell中是否可以查询对象的属性页详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2851064/