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

前端 未结 1 902
谎友^
谎友^ 2020-12-20 10:49

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 h

相关标签:
1条回答
  • 2020-12-20 11:05

    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.

    0 讨论(0)
提交回复
热议问题