powershell 远程处理是否支持在远程目标上使用的 powershell 版本? [英] Does powershell remoting support version of the powershell to be used on remote target?

查看:36
本文介绍了powershell 远程处理是否支持在远程目标上使用的 powershell 版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以提供一个版本的 powershell 以在 ps 远程处理时在目标机器上使用吗.

Can I supply a version of powershell to be used on the target machine while ps remoting.

可能是我的问题不合适或无法回答,但如果有人有想法,请帮助我.

May be my question is not proper or not possible to answer but if any body having idea please help me.

我试图在有 powershell 2.0 3.0 和 4.0 版本的机器上使用 powershell 进行远程处理,但我只想使用 4.0 版本(在目标机器上)有可能吗?

I am trying to do a remoting using powershell on a machine where powershell 2.0 3.0 and 4.0 versions are available , but I want to use the version 4.0 only (on target machine) is it possible?

谢谢吉安

推荐答案

是的,有一种方法可以连接到远程计算机上特定版本的 Powershell.不过,它确实需要在远程机器上进行更改.

Yes, there is a way to connect to a specific version of Powershell on a remote machine. It does require changes to be made on the remote machine though.

当您使用 Powershell 远程处理进行连接时,您始终连接到另一端的特定配置文件.通常,此配置文件称为 Microsoft.Powershell,但其他产品会创建自己的端点,例如 Exchange.

When you use Powershell remoting to make a connection, you are always connecting to a specific profile on the other end. Typically this profile is called Microsoft.Powershell, but other products create their own endpoints, like Exchange for example.

您可以创建自己的配置文件,称为会话配置,设置各种设置,包括 Powershell 版本.

You can create your own profiles, called session configurations, setting various settings, including the Powershell version.

这样做的方法是首先使用New-PSSessionConfigurationFile 然后在目标上注册机器使用 Register-PSSessionConfiguration.

The way to do this is to first create a session configuration file using New-PSSessionConfigurationFile and then register it on the target machine using Register-PSSessionConfiguration.

版本可以在两处指定(Register-PSSessionConfiguration中的值优先),但只需要在一处指定.

The version can be sepcified in both places (the value in Register-PSSessionConfiguration takes precedence) but only needs to be specified in one place.

在目标机器上获得所需的会话后,使用 New-PSSession-ConfigurationName 参数来创建会话,并使用 使用 -Session 参数调用-Command 以传递 New-PSSession 的结果.

Once you've got the session you want on the target machine, use New-PSSession with the -ConfigurationName parameter to create the session, and use Invoke-Command with the -Session parameter to pass the result of New-PSSession.

这篇关于powershell 远程处理是否支持在远程目标上使用的 powershell 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆