【问题标题】:Run Powershell Core from Powershell 5 remote pc从 Powershell 5 远程 pc 运行 Powershell Core
【发布时间】:2020-02-13 13:39:14
【问题描述】:

我已经在远程 PC 上安装了 Powershell Core。

我已使用 Powershell 5 与那台 PC 进行远程会话。

当我跑步时

PowerShell -NoExit "pwsh-preview" 或者只是 pwsh-preview

它显示 Powershell 7 介绍并再次退出到 PS5(见下面的屏幕截图)

【问题讨论】:

    标签: windows powershell server powershell-core


    【解决方案1】:

    你没有展示你是如何验证这正在发生的。

    您所展示的只是迅速返回。

    开始您的会话,然后是 $PSVersionTable,然后键入 pwsh,然后再次键入 $PSVersionTable。

    $PSVersionTable
    
    Name                           Value
    ----                           -----
    PSVersion                      5.1.18362.628
    PSEdition                      Desktop
    PSCompatibleVersions           {...                                                                                 
    
    pwsh
    
    PowerShell 6.2.4
    Copyright (c) Microsoft Corporation. All rights reserved.
    
    https://aka.ms/pscore6-docs
    Type 'help' to get help.
    
    PS D:\Scripts> $PSVersionTable
    
    Name                           Value
    ----                           -----
    PSVersion                      6.2.4
    PSEdition                      Core
    GitCommitId                    6.2.4
    OS                             Microsoft Windows 10.0.18363
    Platform                       Win32NT
    PSCompatibleVersions           {...
    
    PS D:\Scripts> exit
    
    $PSVersionTable
    
    Name                           Value
    ----                           -----
    PSVersion                      5.1.18362.628
    PSEdition                      Desktop
    PSCompatibleVersions           {...
    

    当您在它们之间切换时,您可以轻松更改您的个人资料,以在提示中显示您使用的版本。

    根据您的评论.. .

    没有像“pwsh”这样的命令只有 pwsh-preview PSVersion 5.1.17763.771

    您的陈述不正确。上面的屏幕输出是我运行最新版本 Powershell v7 的系统的确切输出。

    我对此并不陌生。自从它被称为 PowerShell 作为 alpha 用户和内部人员之前,我一直在使用 PowerShell。

    Monad Manifesto – the Origin of Windows PowerShell

    以下是安装时创建的快捷方式的属性。

    快捷方式标题

    'PowerShell 6 (x64)' ---

    快捷方式路径“C:\Program Files\PowerShell\6\pwsh.exe” -工作目录~

    您正在运行较早的预览版,而我正在运行当前版本。因此有区别。

    https://github.com/PowerShell/PowerShell/releases

    PowerShell-6.2.4-win-x64.msi

    PowerShell-6.2.4-win-x64.msix

    PowerShell-6.2.4-win-x64.zip

    PowerShell-6.2.4-win-x86.msi

    PowerShell-6.2.4-win-x86.zip

    【讨论】:

    • 没有类似“pwsh”的命令只有 pwsh-preview PSVersion 5.1.17763.771
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-04
    • 2011-06-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多