[E2010][PS][C#] Core PowerShell commands not available RRS feed

  • Question

  • I am accessing a remote PowerShell session on a Exchange 2010 CAS server from C# code. It works fine except I don't seem to have access to any of the core PowerShell commands (microsoft.powershell.core).

    For example, this command works fine:
    Get-Mailbox -Identity username

    However, if I try to pipe it into a Where-Object command it tells me that the command is not a recognized cmdlet. If I try any core command I get the same response.

    My guess is that only the Exchange management snapin is loaded on the remote CAS server. How would I get it to also load the core snapin? I am looking at the web.config for the PowerShell web application but not quite sure how to add it in.

    I can create full sessions that work fine but those take 40-60 seconds to create. Using the remote session pool takes just a few seconds to setup.

    Anyone seen this issue?

    Thank you

    Wednesday, October 31, 2012 9:50 PM

All replies

  • It's a common issue. 




    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

    Wednesday, October 31, 2012 10:07 PM
  • Thank you for the reply! I did find this and had already made the FullLanguage mode change. This solved my problem of being able to run expandable strings and script blocks. However, I still have the issue of not being able to use any core PowerShell commands. I don't see that addressed in this link.


    Wednesday, October 31, 2012 10:23 PM
  • I don't have an answer for that. 


    I suspect that the fact of the remote session being quick to set up may be closely related to the fact that it has limited functionality, and you could conceivably lose one in pursuit of the other.

    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

    Wednesday, October 31, 2012 10:41 PM