Does powershell remoting support version of the powershell to be used on remote target?

徘徊边缘 提交于 2019-12-29 08:25:09

问题


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.

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?

Thanks Gyan


回答1:


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.

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.

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

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.

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

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.



来源:https://stackoverflow.com/questions/26032784/does-powershell-remoting-support-version-of-the-powershell-to-be-used-on-remote

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!