cannot find the correct module to use Exchange cmdlets

%3CLINGO-SUB%20id%3D%22lingo-sub-1462877%22%20slang%3D%22en-US%22%3Ecannot%20find%20the%20correct%20module%20to%20use%20Exchange%20cmdlets%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1462877%22%20slang%3D%22en-US%22%3E%3CP%3EI%20want%20to%20use%20some%20Exchange%20cmdlets%20in%20Automation%20account%2C%20and%20I%20suppose%20I%20need%20to%20import%20a%20Exchange%20module%20for%20this%20-%20but%20I%20cannot%20find%20the%20correct%20module.%20Does%20anyone%20know%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20like%20to%20use%20these%20two%20cmdlets%20in%20Automation%20account%20(Powershell%20runbook)%20to%20add%20an%20user%20to%20a%20group%2C%20and%20to%20give%20permission%20to%20shared%20mailbox%3A%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CSTRONG%3EAdd-UnifiedGroupLinks%3C%2FSTRONG%3E%20(documentation%20at%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fexchange%2Fadd-unifiedgrouplinks%3Fview%3Dexchange-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fexchange%2Fadd-unifiedgrouplinks%3Fview%3Dexchange-ps%3C%2FA%3E)%3CBR%20%2F%3E%3CSTRONG%3EAdd-MailboxPermission%3C%2FSTRONG%3E%20(documentation%20at%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fexchange%2Fadd-mailboxpermission%3Fview%3Dexchange-ps)%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fexchange%2Fadd-mailboxpermission%3Fview%3Dexchange-ps)%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESomething%20like%20this%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20Param%20(%3C%2FP%3E%3CP%3E%26nbsp%3B%5Bstring%5D%20%24Employee%20%3D%20%22%22%3C%2FP%3E%3CP%3E%26nbsp%3B)%3C%2FP%3E%3CP%3E%26nbsp%3B%20%24credObject%20%3D%20Get-AutomationPSCredential%20-Name%20%22O365servicekonto%22%3C%2FP%3E%3CP%3E%26nbsp%3B%20Connect-AzureAD%20-Credential%20%24credObject%3C%2FP%3E%3CP%3E%26nbsp%3B%20%24User%20%3D%20Get-AzureADUser%20-ObjectId%20%24Employee%3C%2FP%3E%3CP%3E%26nbsp%3B%20Set-AzureADUser%20-ObjectId%20%24User.ObjectId%3C%2FP%3E%3CP%3E%26nbsp%3B%20Add-MailboxPermission%20%3CEMAIL%20of%3D%22%22%20the%3D%22%22%20shared%3D%22%22%20mailbox%3D%22%22%3E%20-User%20%24Employee%20-AccessRights%20FullAccess%20-InheritanceType%20all%3C%2FEMAIL%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1462877%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAutomation%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ECmdlets%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Occasional Contributor

I want to use some Exchange cmdlets in Automation account, and I suppose I need to import a Exchange module for this - but I cannot find the correct module. Does anyone know?

 

I would like to use these two cmdlets in Automation account (Powershell runbook) to add an user to a group, and to give permission to shared mailbox:


Add-UnifiedGroupLinks (documentation at https://docs.microsoft.com/en-us/powershell/module/exchange/add-unifiedgrouplinks?view=exchange-ps)
Add-MailboxPermission (documentation at https://docs.microsoft.com/en-us/powershell/module/exchange/add-mailboxpermission?view=exchange-ps)

 

Something like this

 

  Param (

 [string] $Employee = ""

 )

  $credObject = Get-AutomationPSCredential -Name "O365servicekonto"

  Connect-AzureAD -Credential $credObject

  $User = Get-AzureADUser -ObjectId $Employee

  Set-AzureADUser -ObjectId $User.ObjectId

  Add-MailboxPermission <email of the shared mailbox> -User $Employee -AccessRights FullAccess -InheritanceType all

0 Replies