Skip to content

Latest commit

 

History

History
7 lines (4 loc) · 967 Bytes

File metadata and controls

7 lines (4 loc) · 967 Bytes

Exchange PowerShell Automation Sample

This sample application shows how to connect to a remote Exchange Powershell session, run cmdlets, and receive data. It also shows how variables can be passed into the PowerShell session from the C# code (currently only PSCredential is supported for the variable type).

The code shows how to connect to the PowerShell session directly (which means that only limited calls can be made, due to the runspace being in RestrictedLanguage mode) or to import the remote session into a local PowerShell session (in which case full scripting should be possible). Note that this only works with Exchange on-premises - Exchange Online cmdlets always run in a local PowerShell session as they are now REST backed.

The code works with Exchange On-premises and Exchange Online (which now requires the EXO v3 PowerShell module).