Sha256: bc824d378d18763a92257231d7661423c8f832a57157551446564f3a34675150

Contents?: true

Size: 703 Bytes

Versions: 1

Compression:

Stored size: 703 Bytes

Contents

function ListWindowsFeatures
{    
        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]
                }
            }

            return $feature
        }
        catch
        {
            Throw
        }

}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
specinfra-0.5.4 lib/specinfra/backend/powershell/support/list_windows_features.ps1