import-module exchangepowershell throws exchangeinstallpath missing

OliDE 40 Reputation points
2023-05-31T15:30:55.97+00:00

i'd like to automate some stuff and need to use Add-RecipientPermission.

I used install-module exchangepowershell -scope currentuser

and tried to load the module with

import-module exchangepowershell

but i get the below error.

import-module : Exchange Server system variable ExchangeInstallPath missing.
At line:1 char:1
+ import-module exchangepowershell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Exchange Server...llPath missing.:String) [Import-Module], RuntimeException
    + FullyQualifiedErrorId : Exchange Server system variable ExchangeInstallPath missing.,Microsoft.PowerShell.Commands.ImportModuleCommand

I am wondering whats wrong, this should work on a client machine, not on an exchange server. We use the cloud version of outlook, so there is no exchange on premise at all.

whats also wierd, i have a win10 machine in the network (no access right now) and that works, but i dont know what i did or whats the current situation. right now i am connected through a vpn to a dev server (win11 client) that is inside the AD

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,171 questions
Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Andy David - MVP 157.4K Reputation points MVP Volunteer Moderator
    2023-06-01T11:00:41.4433333+00:00

    There is no need to do this:

    PS P:\> Import-Module ExchangePowerShell Import-Module : Exchange Server system variable ExchangeInstallPath missing. In Zeile:1 Zeichen:1
    

    Make sure you have the correct Exchange roles to run that command. Exchange Admin or Recipient Admin.

    That error indicates you do not:

    PS C:\Users\xx.xx\PycharmProjects\usermgmtautomation> add-recipientPermission add-recipientPermission : The term 'add-recipientPermission' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.


4 additional answers

Sort by: Most helpful
  1. Andy David - MVP 157.4K Reputation points MVP Volunteer Moderator
    2023-05-31T15:34:50.53+00:00

    If you are using Exchange Online, follow these steps to connect:

    the correct command to import:

    Import-Module ExchangeOnlineManagement
    

    https://learn.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell?view=exchange-ps

    2 people found this answer helpful.

  2. Aholic Liang-MSFT 13,886 Reputation points Microsoft External Staff
    2023-06-01T08:11:17.89+00:00

    Hi @ OliDE,

    This cmdlet is available only in the cloud-based service (Exchange online).

    User's image

    In addition to using this command(Import-Module ExchangeOnlineManagement) to import the Exchange PowerShell module, you need to log on to Exchange Online PowerShell with an Exchange administrator account:

     

    Connect-ExchangeOnline -UserPrincipalName ******@contoso.onmicrosoft.com
    

     

    After entering the password for successful verification, use the Exchange Online related commands.

    For details of how to connect Exchange online PowerShell, please refer to this link: Connect to Exchange Online PowerShell | Microsoft Learn


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

  3. OliDE 40 Reputation points
    2023-06-02T06:43:07.9466667+00:00

    this is so wierd... i changed nothing and it works again now. calling add-recipientinformation now works, thanks!

    0 comments No comments

  4. OliDE 40 Reputation points
    2023-06-02T07:27:04.0433333+00:00

    it was a permission problem... unfortunately there seems to be no delete comment option

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.