Wednesday, 1 November 2017

Get-WebBinding PowerShell cmdlet gives "Value does not fall within the expected range" error if any of the bindings use the central certificate store (CCS).

When using the Get-WebBinding PowerShell you may see the error "Value does not fall within the expected range" error  if any of the bindings use the central certificate store (CCS).

Value does not fall within the expected range.
    + CategoryInfo          : NotSpecified: (:) [Select-Object], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.SelectObjectCommand

This error only occurs  if you perform the following locally

Get-WebBinding|SELECT *

The error also occurs if you try and execute the command using a PowerShell remoting session as the object has to be serialized.

Strangely the cmdlet does correctly return all individual properties. The solution when running remotely using C# is to select only the properties you require by calling ExecuteScript and running
Get-WebBinding|SELECT BindingString etc








No comments:

Post a Comment