PoshCode Archive  Artifact Content

Artifact 6318d0047d596359afb224d44debabdc6da69f9343cdb23578233bdc6ab60820:

  • File drivers-list.ps1 — part of check-in [68b09a28a5] at 2018-06-10 13:50:19 on branch trunk — Fixed (user: greg zakharov size: 1363)

# encoding: ascii
# api: powershell
# title: drivers list
# description: Fixed
# version: 0.1
# type: script
# author: greg zakharov
# license: CC0
# x-poshcode-id: 5121
# x-archived: 2015-01-31T20:31:36
# x-published: 2015-04-28T05:40:00
#
#
#requires -version 2.0
gp -ea 0 HKLM:\SYSTEM\CurrentControlSet\Services\* | ? {
  $_.Type -eq 1 -and $_.ImagePath -ne $null
} | select @{
  N='Name';E={$_.PSChildName}
}, @{
  N='Path';E={
    $$ = $_.ImagePath.ToLower()
    $pat = Split-Path -Leaf ($dir = [Environment]::SystemDirectory)
    if ($$.StartsWith('\')) {
      $$ = $$.Substring((($i = $$.IndexOf('\', 2)) + 1), ($$.Length - $i - 1))
      if (Test-Path $$) { return $$ }
    }
    $script:itm = [Regex]::Replace($$, $pat, $dir)
    $itm
  }
}, @{
  N='Description';E={
    $script:des = (gci $itm).VersionInfo
    $des.FileDescription
  }
}, @{
  N='Publisher';E={$des.CompanyName}
}, @{
  N='Version';E={$des.ProductVersion}
}, @{
  N='Error Control';E={'0x{0:X8}' -f $_.ErrorControl}
}, @{
  N='Launch Type';E={
    switch ($_.Start) {
      0 { 'Ring0' }    #low level driver
      1 { 'OnBoot' }   #load and init after kernel
      2 { 'Auto' }     #SCM loads driver automatically
      3 { 'Manual' }   #SCM loads driver when it need
      4 { 'Disabled' }
    }
  }
} | Out-GridView -Title Drivers