powershellconnection-stringwsman

Why is the connectionUri different in WSManConnectionInfo object for exchange and windows?


For exchange the connection uri used is :

http://machineName/powershell

The WSManConnectionInfo object is created in the following way:

WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("http://machineName/powershell"), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", ExchangeCredential)

To connect to windows, the uri used is

http://machineName:5985/wsman 

The WSManConnectionInfo object is created in the following way:

WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("http://machineName:5985/wsman"), "http://schemas.microsoft.com/powershell/Microsoft.PowerShell", credential);

Why is there a difference in the connection uri for exchange and windows?


Solution

  • Exchange implements its own PowerShell remoting endpoint, which is IIS hosted. This endpoing (among other things) implements Role-based access control (RBAC), only giving access to the Cmdlets the connecting user has permissions to use (the default endpoint doesn't do this).