スプラッティング記号であるアットマーク@をしようすることでパラメータ名とパラメータ名の組み合わせを連想配列として変数に格納することができる。

PS C:\Users\yuta> $params = @{LogName="Application";Newest=5}
PS C:\Users\yuta> Get-EventLog @params

   Index Time          EntryType   Source                 InstanceID Message
   ----- ----          ---------   ------                 ---------- -------
    2599 9 14 00:53    Information Windows Error Rep...         1001 障害バケット 129500666414、種類 5...
    2598 9 13 23:18    Information Software Protecti...   1073758208 ソフトウェア保護サービスの 2117-08-20T14:18:57Z...
    2597 9 13 23:08    Error       Perflib                3221226480 ソース 'Perflib' のイベント ID '-1073740816' の...
    2596 9 13 22:55    Information VSS                          8224 アイドル タイムアウトにより VSS サービスをシャ...
    2595 9 13 22:48    Information Software Protecti...   1073758208 ソフトウェア保護サービスの 2117-08-20T13:48:54Z...

以下とおんなじ意味。

PS C:\Users\yuta> Get-EventLog -LogName Application -Newest 5

   Index Time          EntryType   Source                 InstanceID Message
   ----- ----          ---------   ------                 ---------- -------
    2599 9 14 00:53    Information Windows Error Rep...         1001 障害バケット 129500666414、種類 5...
    2598 9 13 23:18    Information Software Protecti...   1073758208 ソフトウェア保護サービスの 2117-08-20T14:18:57Z...
    2597 9 13 23:08    Error       Perflib                3221226480 ソース 'Perflib' のイベント ID '-1073740816' の...
    2596 9 13 22:55    Information VSS                          8224 アイドル タイムアウトにより VSS サービスをシャ...
    2595 9 13 22:48    Information Software Protecti...   1073758208 ソフトウェア保護サービスの 2117-08-20T13:48:54Z...

<スポンサーリンク>

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

*

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)