Forum Discussion

mbromb's avatar
mbromb
Copper Contributor
Apr 08, 2020
Solved

Exchange Online PowerShell V2 module Connect-ExchangeOnline CommandName switch

Is there a way to limit the cmdlets that are retrieved when using the Exchange Online PowerShell V2 module? Cmdlet Connect-ExchangeOnline does not appear to have the equivalent CommandName switch that Import-PSSession has.

  • Well, it's a "wrapper" cmdlet, it calls Import-PSSession internally. You can modify the corresponding script containing the cmdlet, which you can find under: C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\XXXX\ExchangeOnlineManagement.psm1

     

    Or you can do "manual" connectivity by getting a token directly and passing it to New-PSSession (although you will loose some functionalities).

Resources