45002

Forcing version 2 on remote session for SharePoint management using Powershell

Question:

It seems that SharePoint 2010 is still incompatible with PowerShell version 3.0.

I am already aware that it is possible to force compatibility by executing PowerShell with the -v 2 switch, but is there a way to force this compatibility mode when using a remote session via PSSession as using a remote desktop is quite impractical just to launch a shell?

Answer1:

<strike>If you start the client PowerShell with -v 2. Then outgoing remote sessions should use v2 on the remote end automatically.</strike>

<strong>Update</strong>: it appears I am mistaken - I think in fact I had discussed this with the PowerShell team, but apparently it's not fixed. Anyway, you can create a session configuration on the server that is forced to version 2.0:

PS> $psversiontable Name Value ---- ----- PSVersion 3.0 WSManStackVersion 3.0 SerializationVersion 1.1.0.1 CLRVersion 4.0.30319.18010 BuildVersion 6.2.9200.16434 PSCompatibleVersions {1.0, 2.0, 3.0} PSRemotingProtocolVersion 2.2 PS> Register-PSSessionConfiguration -PSVersion '2.0' -Name "powershell2"

Accept all of the prompts. Now, you must pass the name of the new remote session configuration when invoking from the client side (in this example, the client and server are the same machine: my desktop)

PS> icm localhost -ConfigurationName powershell2 { $psversiontable } Name Value ---- ----- PSRemotingProtocolVersion 2.1 BuildVersion 6.1.7600.16385 PSCompatibleVersions {1.0, 2.0} PSVersion 2.0 CLRVersion 2.0.50727.6400 WSManStackVersion 2.0 SerializationVersion 1.1.0.1

As you can see, the remote endpoint is running 2.0.

I hope this helps.

Recommend

  • Applying a function returning list/matrix row-wise in data.table
  • Custom 404 error template in twig 2.5 with symfony 4.1
  • Wrong LastLogon returned from Win32_NetworkLoginProfile
  • Memory leak with Log4j2 custom Hibernate Appender
  • Force repaint after button click
  • How to insert zeros between elements in a numpy array?
  • SELECT then immediately DELETE mysql record
  • Web Push notifications with iOS 11.3
  • Spring 4.3.x with OpenJDK 11
  • How to draw a circle of lines
  • making an array of bigInteger of size biginteger in java
  • Why do I get IPC delays on 20% busy machine
  • How to test Rate this app functionality before submitting to app store
  • Changing UITableViewCell's width constraint's constant value for each instance
  • How to use Twitter gem in Rails, need small to figure out the whole thing?
  • Get a class as javax.lang.model.element.Element in junit tests
  • Get all the values from excel file by using linqtoexcel
  • How to get full url in Angular?
  • Variable with usage COMP in COBOL
  • Sending in an object of type Object instead of String - Polymorphism
  • JQuery and PHP validation problem?
  • magento 2 rest api : get cart items with images
  • Insert inline image into Lotus Notes message
  • apache zeppelin is started but there is connection error in localhost:8080
  • Creating and managing two independent random number sequences
  • How to smoothly connect two signals in matlab [closed]
  • Bazel failed to include a external static library .a
  • Could not resolve all files for configuration ':react-native-vector-icons:classpath'
  • Failed to resolve: firebase-auth-15.0.0 [closed]
  • Google TV VideoView playing YouTube rtsp videos
  • Query regarding com.jcraft.jsch.JSchException: UnknownHostKey: x.y.com. DSA key fingerprint is “ac:e
  • Implementation of timeout in LDAP
  • Issue with Terrain Collision using Three.js
  • JQuery Mobile Ajax Navigation in Single-Page Template
  • Problems to understand DXGI DirectX 11 Desktop Duplication to get a Buffer or Array
  • C++ STL stack pop operation giving segmentation fault
  • Another “Cannot make static reference…” Question
  • VSTS work items list through REST API
  • Can someone explain this Java code (formatting the output using System.out.format) to me?
  • Jersey serializes character value to ASCII equivalent numeric string