我有一个PSObjects哈希表,该哈希表包含有关widnows修补程序和CVE编号的信息,它采用以下格式:
ID : 2022-Sep
InitialRealeaseDate : 13/09/2022 07:00:00
CvrfUrl : https://api.msrc.microsoft.com/cvrf/v2.0/document/2022-Sep
Severity :
DocumentTitle : September 2022 Security Updates
cve : CVE-2022-37969
Alias : 2022-Sep
CurrentReleaseDate : 04/10/2022 07:00:00我正在尝试提取具有匹配CVE的记录。我认为他应该工作:
$results | where {$results.cve -eq 'CVE-2022-38006'}但是它返回许多记录(包括正确的记录),但是对于大多数情况下,$records.cve元素与请求的过滤器完全没有任何共同点,我不希望它被返回。
ID : 2022-Sep
InitialRealeaseDate : 13/09/2022 07:00:00
CvrfUrl : https://api.msrc.microsoft.com/cvrf/v2.0/document/2022-Sep
Severity :
DocumentTitle : September 2022 Security Updates
cve : CVE-2022-37969
Alias : 2022-Sep
CurrentReleaseDate : 04/10/2022 07:00:00
ID : 2022-Sep
InitialRealeaseDate : 13/09/2022 07:00:00
CvrfUrl : https://api.msrc.microsoft.com/cvrf/v2.0/document/2022-Sep
Severity :
DocumentTitle : September 2022 Security Updates
cve : CVE-2022-38004
Alias : 2022-Sep
CurrentReleaseDate : 04/10/2022 07:00:00
ID : 2022-Sep
InitialRealeaseDate : 13/09/2022 07:00:00
CvrfUrl : https://api.msrc.microsoft.com/cvrf/v2.0/document/2022-Sep
Severity :
DocumentTitle : September 2022 Security Updates
cve : CVE-2022-38005
Alias : 2022-Sep
CurrentReleaseDate : 04/10/2022 07:00:00
ID : 2022-Sep
InitialRealeaseDate : 13/09/2022 07:00:00
CvrfUrl : https://api.msrc.microsoft.com/cvrf/v2.0/document/2022-Sep
Severity :
DocumentTitle : September 2022 Security Updates
cve : CVE-2022-38006
Alias : 2022-Sep
CurrentReleaseDate : 04/10/2022 07:00:00Get成员说CVE元素是一个字符串:
PS E:\Scripts\Ian\GIT\XDR> $results | gm
TypeName: System.Management.Automation.PSCustomObject
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Alias NoteProperty string Alias=2022-Sep
CurrentReleaseDate NoteProperty string CurrentReleaseDate=04/10/2022 07:00:00
cve NoteProperty string cve=
CvrfUrl NoteProperty string CvrfUrl=https://api.msrc.microsoft.com/cvrf/v2.0/document/2022-Sep
DocumentTitle NoteProperty string DocumentTitle=September 2022 Security Updates
ID NoteProperty string ID=2022-Sep
InitialRealeaseDate NoteProperty string InitialRealeaseDate=13/09/2022 07:00:00
Severity NoteProperty string Severity=我做错了什么?
发布于 2022-10-07 09:32:58
而不是:
$results | where {$results.cve -eq 'CVE-2022-38006'}尝试:
$results | where {$_.cve -eq 'CVE-2022-38006'}或者更简单地说:
$results | where cve -eq 'CVE-2022-38006'https://stackoverflow.com/questions/73985047
复制相似问题