Use. netframework 3.0 in Windows powershell 2.0

Source: Internet
Author: User

Both Windows 8 and Windows Server 2012 have windows powershell 3.0

Windows powershell 3.0 uses. netframework 4.0.

An error occurred while executing the. netframework 2.0 script.

For example, Sharepoint 2010

You cannot access the local server farm. The cmdlet with featuredependencyid is not registered. PS c: \ Users \ luozhuang> remove-spwebapplication-identity http: // win-kfmi99jvfn9/-confirmremove-spwebapplication: Microsoft. NET runtime version 4.0.30319.18010 does not support Microsoft SharePoint. Location row: 1 character: 1 + remove-spwebapplication-identity http: // win-kfmi99jvfn9/-confirm + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Categoryinfo: invaliddata: (Microsoft. share... pwebapplication: spcmdletremovespwebapplication) [remove-spwebapplication], platformnotsuppo rtedexception + fullyqualifiederrorid: Microsoft. sharepoint. powershell. spcmdletremovesp webapplicationps c: \ Users \ luozhuang>

What should I do? Check it online and say yes

Registry key: HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ powershell \ 1 \ powershellengine
Modify the runtimeversion Of the. NET Framework you want to use.

The result does not work.

Solution:

Server Manager-> Add roles and features. go to Server Management> Add roles and functions. For win2012, go to Control Panel> uninstall or change program> enable or disable windows.

Choose to install the following two features

. NET Framework 3.5
Windows powershell 2.0

After the installation is complete, you need to use the following steps to run. netframework 2.0:

PowerShell.exe -Version 2

For example, modify the shortcut of SharePoint 2012 as follows:

C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -Version 2 -NoExit " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ' "

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.