Need Windows Update Install Date from Get-Package SwidTagText object. The object is in XML format and everything I have tried to convert doesn't work.
I am trying to switch from WMI because its terribly slow to pull back results.
Tried the ConvertFrom-XML function. Also tried ConvertFrom-String
Get-Package -ProviderName msu | Select-Object *
PropertyOfSoftwareIdentity : PropertyOfSoftwareIdentity
FastPackageReference : Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.297.486.0)
ProviderName : msu
Source :
Status : Installed
SearchKey :
FullPath : ?
PackageFilename : ?
FromTrustedSource : False
Summary : Install this update to revise the definition files that are used to detect viruses, spyware, and other potentially
unwanted software. Once you have installed this item, it cannot be removed.
SwidTags : {Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.297.486.0)}
CanonicalId : msu:Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.297.486.0)
Metadata : {summary,SupportUrl,Date,ResultCode}
SwidTagText : <?xml version="1.0" encoding="utf-16" standalone="yes"?>
<SoftwareIdentity
name="Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.297.486.0)"
xmlns="http://standards.iso.org/iso/19770/-2/2015/schema.xsd">
<Meta
summary="Install this update to revise the definition files that are used to detect viruses, spyware, and other
potentially unwanted software. Once you have installed this item, it cannot be removed."
SupportUrl="https://go.microsoft.com/fwlink/?LinkId=52661"
Date="7/5/2019 6:17:09 PM"
ResultCode="2" />
</SoftwareIdentity>
Dependencies : {}
IsCorpus :
Name : Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.297.486.0)
Version :
If you're trying to get the raw dates out of the XML you could do something like this:
This gives you each entry to work with like so:
You then use Select-XML/XPath to pick out the specific date attribute.
My example will give just a list of all the dates, but you could tweak it if you need extra information along side it.