How to use PowerShell to list the version number and SP service patches for the. NET Framework on your machine

Source: Internet
Author: User

code Download : The script mentioned in this article can be downloaded from the Microsoft Code base, how to determine versions & service pack levels of the. NET Framework by Powersh Ell

Case scenario

a very common scenario for you as a developer or IT Administrator is that you need to know which Microsoft. NET Framework versions are installed on your or customer's machine , and there are no better quick ways to get all of them . NET Framework version information?

Solution Solutions

The scheme is quite a lot ah, for example the following common:

      using Windows Explorer get
    • get
    • command Prompt Run command-line program get

However, "there are thousands of flowers, I Only love one", today we introduce one and its useful another way, using PowerShell script to get The version number of the. NET Framework and SP service patch information.

The core principle of this script is also by reading the registry, but after all, not everyone has to deal with the registry every day, such as small, like me, face the Registry a bunch of information, it is two eyes a smear ah!!! So there is a direct script that can be run, it is more convenient ~ ~

Operational requirements

We have a request, the machine installed PowerSHell 2.0 that is must drop!

How do I use it?

  1. Go to Microsoft's official code base to download this script (very small,1.73K) -https:// gallery.technet.microsoft.com/how-to-determine-versions-d3669799 determinenetframeworkversion.ps1
  2. Open PowerShell as an administrator and run the following command:set-executionpolicy-executionpolicy remotesigned
  3. When prompted, enter a
  4. Right-click the script you just downloadeddeterminenetframeworkversion.ps1, in the security entry, click unblock < Span style= "font-family: ' Segoe UI '; FONT-SIZE:10PT, "lang=" X-none ">

< Span style= "font-family: ' Segoe UI '; font-size:10pt; "lang=" X-none ">< Span style= "font-family: ' Microsoft Yahei '; font-size:10pt; "lang=" X-none ">

5. Last Run script . \DetermineNe Tframeworkversion.ps1

Code Learning

For the retwist heart of the small apes, do not learn how to realize how to rest assured that:

Functionget-netframeworkversion {$RegistryPrefix="Registry::"; #4-clientTry {IF((Get-itemproperty-erroraction Stop-path ($RegistryPrefix+"hkey_local_machine\software\microsoft\net Framework setup\ndp\v4\client") | Select-expandproperty"Install")-eq1)-and(Get-itemproperty-erroraction Stop-path ($RegistryPrefix+"hkey_local_machine\software\microsoft\net Framework setup\ndp\v4\client") | Select-expandproperty"Version")-eq"4.0.30319.0") ) {Write-host". NET Framework 4-client"; }} Catch {}#4-fullTry {IF((Get-itemproperty-erroraction Stop-path ($RegistryPrefix+"hkey_local_machine\software\microsoft\net Framework setup\ndp\v4\full") | Select-expandproperty"Install")-eq1)-and(Get-itemproperty-erroraction Stop-path ($RegistryPrefix+"hkey_local_machine\software\microsoft\net Framework setup\ndp\v4\full") | Select-expandproperty"Version")-eq"4.0.30319.0") ) {Write-host". NET Framework 4-full"; }} Catch {}# ..... } Get-netframeworkversion

How to use PowerShell to list the version number and SP service patches for the. NET Framework on your machine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.