首页 > 解决方案 > 如何在命令 Get-ItemProperty 中添加上次访问时间

问题描述

如何在此命令中添加 lastaccess 时间:

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -AutoSize

标签: powershellscripting

解决方案


恐怕你不能。要查看您可以选择的所有属性,请运行以下命令:

 Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | 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()
DisplayIcon     NoteProperty string DisplayIcon=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Commo...
DisplayName     NoteProperty string DisplayName=Visual Studio Enterprise 2019
DisplayVersion  NoteProperty string DisplayVersion=16.2.29209.62
InstallDate     NoteProperty string InstallDate=20190715
InstallLocation NoteProperty string InstallLocation=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
ModifyPath      NoteProperty string ModifyPath="C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installe...
PSChildName     NoteProperty string PSChildName=18bd80bd
PSDrive         NoteProperty PSDriveInfo PSDrive=HKLM
PSParentPath    NoteProperty string PSParentPath=Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\Software\Wow...
PSPath          NoteProperty string PSPath=Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\Software\Wow6432No...
PSProvider      NoteProperty ProviderInfo PSProvider=Microsoft.PowerShell.Core\Registry
Publisher       NoteProperty string Publisher=Microsoft Corporation
RepairPath      NoteProperty string RepairPath="C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installe...
UninstallString NoteProperty string UninstallString="C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_ins...

LastAccessTime 不是注册表项的属性。

也许您可以使用安装路径并在其中获取可执行文件的 ItemProperties 以确定最后一次使用该软件的时间。


推荐阅读