powershell:temp

http://ilovepowershell.com/2017/02/19/what-is-your-net-framework-version-use-powershell-to-check/

function Get-iLPNetFrameworkVersion {
    [CmdletBinding()]
    [OutputType([System.Collections.Generic.List[PSCustomObject]])]
    param(
        [string[]]$Computer = "localhost"
    )

    $Local:Function_ReturnList = New-Object -TypeName 'System.Collections.Generic.List[PSCustomObject]'

    $ScriptBlockToRun = {
        $Local:ScriptBlock_ReturnList = New-Object -TypeName 'System.Collections.Generic.List[PSCustomObject]'

        Get-Childitem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' | ForEach-Object {
            $Local:Current_CultureID    = [System.Int16]::Parse(([System.Text.RegularExpressions.Regex]::Match(($_.Name), "\d+$")).Groups[0].Value)
            $Local:Current_CultureObj   = [System.Globalization.CultureInfo]::GetCultureInfo($Current_CultureID)
            $Local:Current_VersionObj   = [System.Version]::Parse($_.GetValue("Version"))
            $Local:Current_ReturnObject = [PSCustomObject]@{
                Computername = $env:COMPUTERNAME
                Culture_LCID = $Current_CultureObj.LCID
                Culture_Name = $Current_CultureObj.Name
                Culture_DisplayName = $Current_CultureObj.DisplayName
                NETFramework_Release = $_.GetValue("Release")
                NETFramework_Version = $Current_VersionObj
                NETFramework_VersionShort = [System.Version]::Parse( ( ([System.Text.RegularExpressions.Regex]::Match(($Current_VersionObj.ToString(3)), "^.*\.\d")).Groups[0].Value) )
            }
            $ScriptBlock_ReturnList.Add($Current_ReturnObject)
        }
        return ,$ScriptBlock_ReturnList
    }

    $Computer | ForEach-Object {
        if ( (@("localhost",($env:COMPUTERNAME))).Contains($_) ) {
            $Function_ReturnList.AddRange( (. $ScriptBlockToRun) )
        } else {
            $Function_ReturnList.AddRange( (Invoke-Command -Session (New-PSSession $Computer) -ScriptBlock $ScriptBlockToRun ))
        }
    }

    return ,$Function_ReturnList
}

$Local:TestResult = Get-iLPNetFrameworkVersion
$Local:CLIFile_FullName  = (Join-Path -Path ($env:temp) -ChildPath "DotNerFramwework_Scan.xml")
$TestResult.GetType().FullName

$TestResult | Where-Object { $_.NETFramework_VersionShort -ge [System.Version]::Parse("4.5") }

$TestResult | Export-Clixml -Path $CLIFile_FullName -Force

####

$Local:CLIFile_FullName  = (Join-Path -Path ($env:temp) -ChildPath "DotNerFramwework_Scan.xml")
$e = Import-Clixml -Path $CLIFile_FullName
$e | Where-Object  { ($_.NETFramework_VersionShort -ge [System.Version]::Parse("4.5")) }
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License