Sha256: 77fc201a86fd05a696c39ace50165ad0d9039ac5b7750aa18bb33d745fd76f30
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
function ListWindowsFeatures { $cachepath = "${env:temp}/ListWindowsFeatures.xml" $maxAge = 2 $cache = Get-Item $cachepath -erroraction SilentlyContinue if($cache -ne $null -and ((get-date) - $cache.LastWriteTime).minutes -lt $maxage){ return Import-Clixml $cachepath } else{ try { $dism = DISM /Online /Get-Features /Format:List | Where-Object {$_} if($LASTEXITCODE -ne 0) { Write-Error $dism Break } $f = $dism[4..($dism.length-2)] $feature = for($i=0; $i -lt $f.length;$i+=2) { $tmp = $f[$i],$f[$i+1] -replace '^([^:]+:\s)' New-Object PSObject -Property @{ Name = $tmp[0] State = $tmp[1] } } $feature | Export-Clixml $cachepath return $feature } catch { Throw } } }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
specinfra-0.5.5 | lib/specinfra/backend/powershell/support/list_windows_features.ps1 |