I wrote a script that constructs a custom object and exports it to a CSV file:
$reg = Get-ItemProperty HKLM:\\SOFTWARE\\McAfee\\DLP\\Agent | Select-Object ag
The expression:
Select-Object {$_.LastWriteTime}
outputs an object with a single property with name $_.LastWriteTime
. The simplest way to fix it is to use the -ExpandProperty
parameter which will only output the value that you are interested in. e.g.:
$date86 = Get-ItemProperty 'C:\Program Files (x86)\McAfee'|
Select-Object -ExpandProperty LastWriteTime
Note that I've also removed the script block from the Select-Object
command, as it wasn't necessary.