在快捷方式目标中指定PowerShell版本不起作用



我有两个Windows Server 2012 R2 64位设置,并具有SharePoint 2010 Management Shell Shell快捷链接链接固定在我的任务栏上。这两个快捷方式都指定 - 反转2,但只有一台服务器似乎尊重该标志。为什么在服务器上不兑现版本2标志?

在一台服务器上,简短的目标属性为:

C:WindowsSystem32WindowsPowerShellv1.0PowerShell.exe -Version 2 -NoExit  " & ' C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14CONFIGPOWERSHELLRegistration\sharepoint.ps1 ' "

当PowerShell按预期打开Get-host返回2.0版。

Name             : ConsoleHost
Version          : 2.0
InstanceId       : b0c653b6-8951-46c9-a5a6-00fe49d70e79
UI               : System.Management.Automation.Internal.Host.InternalHostUserI
                   nterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

在另一台服务器上,但是链接也是:

C:WindowsSystem32WindowsPowerShellv1.0PowerShell.exe -Version 2 -NoExit  " & ' C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14CONFIGPOWERSHELLRegistration\sharepoint.ps1 ' "

但待主持人返回以下内容:

Name             : ConsoleHost
Version          : 4.0
InstanceId       : 1a9413a0-cdbb-46a3-bbe3-b3dbc72fad38
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

转到:

c: windows system32 windowspowershell v1.0有一个powershell.exe.config

删除<supportedRuntime version="v4.0.30319"/>行,然后将文件留下:

<configuration> 
    <startup useLegacyV2RuntimeActivationPolicy="true"> 
        <supportedRuntime version="v2.0.50727"/> 
    </startup> 
</configuration>

如果您已经检查了DB权限以使Shell访问

执行此操作。

最新更新