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

被刻印的时光 ゝ 提交于 2019-11-29 13:05:13

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.

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