2011/01/19

PowerShell: アプリケーションのインストール日時を取得するコマンド

アプリケーションのインストール日時を取得するコマンドは

get-wmiobject win32_product | sort InstallDate | foreach{$_.InstallDate + " : " + $_.name}

20101202 : Microsoft Visual C++ 2005 Redistributable (x64)
20101202 : HP アレイ コンフィギュレーション ユーティリティ CLI
20101202 : HP ProLiant iLO 3 WHEA Driver (X64)
20101202 : HP Smart アレイSAS/SATAイベント通知サービス
20101202 : HP アレイ コンフィギュレーション ユーティリティ
20101202 : HP Insight Diagnostics  Online Edition for Windows
20101202 : HP ProLiant iLO 3 Core Driver (X64)
20101202 : HP ProLiant iLO 3 CHIF Driver (X64)
20101202 : Microsoft Visual C++ 2005 Redistributable (x64)
20101202 : HPバージョン コントロール エージェント for Windows
20101202 : PFA Server Registry Update
20101202 : Microsoft Visual C++ 2005 Redistributable

アプリケーションバージョンも必要ならば

get-wmiobject win32_product | sort InstallDate | foreach{$_.InstallDate + " : " + $_.name +"; Ver " + $_.Version}

 

win32_productは

MSIでインストールされたアプリケーション情報を格納するクラスです。

単にアプリケーションの情報を取得するだけなら「get-wmiobject」の引数に「win32_product」を渡せばOKです。

get-wmiobject win32_product

 

win32_productに格納される情報を確認するには以下を実行します。

get-wmiobject win32_product | get-member

   TypeName: System.Management.ManagementObject#root\cimv2\Win32_Product

Name                MemberType   Definition
----                ----------   ----------
Configure           Method       System.Management.ManagementBaseObject Configure(System.UInt16 InstallState, System...
Reinstall           Method       System.Management.ManagementBaseObject Reinstall(System.UInt16 ReinstallMode)
Uninstall           Method       System.Management.ManagementBaseObject Uninstall()
Upgrade             Method       System.Management.ManagementBaseObject Upgrade(System.String PackageLocation, Syste...
AssignmentType      Property     System.UInt16 AssignmentType {get;set;}
Caption             Property     System.String Caption {get;set;}
Description         Property     System.String Description {get;set;}
HelpLink            Property     System.String HelpLink {get;set;}
HelpTelephone       Property     System.String HelpTelephone {get;set;}
IdentifyingNumber   Property     System.String IdentifyingNumber {get;set;}
InstallDate         Property     System.String InstallDate {get;set;}
InstallDate2        Property     System.String InstallDate2 {get;set;}
InstallLocation     Property     System.String InstallLocation {get;set;}
InstallSource       Property     System.String InstallSource {get;set;}
InstallState        Property     System.Int16 InstallState {get;set;}
Language            Property     System.String Language {get;set;}
LocalPackage        Property     System.String LocalPackage {get;set;}
Name                Property     System.String Name {get;set;}
PackageCache        Property     System.String PackageCache {get;set;}
PackageCode         Property     System.String PackageCode {get;set;}
PackageName         Property     System.String PackageName {get;set;}
ProductID           Property     System.String ProductID {get;set;}
RegCompany          Property     System.String RegCompany {get;set;}
RegOwner            Property     System.String RegOwner {get;set;}
SKUNumber           Property     System.String SKUNumber {get;set;}
Transforms          Property     System.String Transforms {get;set;}
URLInfoAbout        Property     System.String URLInfoAbout {get;set;}
URLUpdateInfo       Property     System.String URLUpdateInfo {get;set;}
Vendor              Property     System.String Vendor {get;set;}
Version             Property     System.String Version {get;set;}
WordCount           Property     System.UInt32 WordCount {get;set;}
__CLASS             Property     System.String __CLASS {get;set;}
__DERIVATION        Property     System.String[] __DERIVATION {get;set;}
__DYNASTY           Property     System.String __DYNASTY {get;set;}
__GENUS             Property     System.Int32 __GENUS {get;set;}
__NAMESPACE         Property     System.String __NAMESPACE {get;set;}
__PATH              Property     System.String __PATH {get;set;}
__PROPERTY_COUNT    Property     System.Int32 __PROPERTY_COUNT {get;set;}
__RELPATH           Property     System.String __RELPATH {get;set;}
__SERVER            Property     System.String __SERVER {get;set;}
__SUPERCLASS        Property     System.String __SUPERCLASS {get;set;}
PSStatus            PropertySet  PSStatus {Name, Version, InstallState}
ConvertFromDateTime ScriptMethod System.Object ConvertFromDateTime();
ConvertToDateTime   ScriptMethod System.Object ConvertToDateTime();

 

 

参考: アプリケーションのインストール日時を取得する - PowerShell Memo

0 件のコメント:

コメントを投稿