ticketmaster / poshspec

Infrastructure Testing DSL running in Pester
MIT License
183 stars 32 forks source link

more efficient method for package checking #53

Closed rismoney closed 7 years ago

rismoney commented 7 years ago

Here is what I typically do-

$apps64=Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
$apps32=Get-ChildItem HKLM:\SOFTWARE\Wow6432node\Microsoft\Windows\CurrentVersion\Uninstall
$allapps=$apps64+$apps32

  Describe "ActivePerl" {
    It "ActivePerl 5.16.3 Build 1603 (64-bit) should be installed" {
      if ($allapps | gp | ? {$_.DisplayName -eq "ActivePerl 5.16.3 Build 1603 (64-bit)" }) {$activeperl=$true} else {$activeperl=$false}
      $activeperl | Should Be $true
    }
}

This avoids all issues querying win32_product.

rismoney commented 7 years ago

i think this is the same as SoftwareProduct.ps1 - i think it can be closed.