Exchange_AddIn Module


Here is another PowerShell (PS) toolset I have been working on, the ‘Exchange_AddIn’ module. This module is a combination of several other scripts that are either on the internet or action items customers need help with in their day to day tasks. By combining several lines of code into a single verb-noun command let (cmdlet), it makes repeatable, mundane tasks much easier. In fact, once you have the hang of them, you could delegate them out to other team members with a few minutes of training. Then you would have more time to spend on other aspects of your job, like creating more functions for even further delegation or combining tasks into a completely automated process.

Here is a list of the current cmdlets:

Connect-ExchangeServer – connects to an on premises Exchange server
Connect-ExchangeOnline – connects to an Exchange online, O365 tenant
Disconnect-ExchangeOnline – disconnects Exchange Online session
Get-DatabaseInformation
– obtains DAG database status
Start-DAGMaintenanceMode – puts a DAG node into DAG maintenance mode
Stop-DAGMaintenanceMode – sets a DAG node out of DAG maintenance mode
Get-DotNETVersion – acquires the current .NET version on a server (can be used for any computer, not just an Exchange server)
Request-CredentialExchangeOnline – allows you to reset your credentials if you fat finger them into the prompt
Request-CredentialExchangeOnPremises – allows you to reset your onsite credentials to sign into a server

This PS module is designed for both onsite and hybrid Exchange organizations. The main difference between this module and my O365_Logon module, is the ability to add in prefix values to the connects. This allows engineers to have both an on premises connection and a cloud connection in the same PS session, thus permitting more flexibility and while maintaining less open windows in PS.

I also included Request-CredentialExchangeOnline and Request-CredentaialExchangeOnPremises cmdlets. This allows you to request a new credential pop-up in case you incorrectly put in the wrong credentials (which I seem to do often), without having to close PS windows every time you make a simple mistake. The module can’t detect good/bad credentials, but there is full logic in place to confirm if you successfully have been logged onto the Exchange online service or not. I might put additional logic in for the on premises confirmation, but I don’t have any in there yet.

How to install this module

Two ways:

  1. If you are running PS 5 or higher, you can simply open PS and type in: Install-Module Exchange_AddIn and it will install it for you from the PowerShell Gallery

Or

  1. A manual module install is extremely easy. Attached to this blog post is the Exchange_AddInModule.zip file, or download the zip file from the MS Script Center. After you unzip the file, all you need is to copy/paste the O365_Logon folder into one of the following locations:
  • %Windir%\System32\WindowsPowerShell\v1.0\Modules
  • %UserProfile%\Documents\WindowsPowerShell\Modules
  • %ProgramFiles%\WindowsPowerShell\Modules

 

How to use this module

Once this module is installed, you can set the execution policy to either Remote Signed (recommended) or Unrestricted.

Set-ExecutionPolicy RemoteSigned

Launch Windows PowerShell, or Windows PowerShell ISE (‘Run as Administrator’ not required) and start using the cmdlets. It should be that easy!

Conclusion

I’m already working on other functions and cmdlets to add in the next version, so stay tuned. I hope you find this Exchange Add In Module helpful. It should assist you in making your day to day Exchange tasks within PowerShell quicker and easier. Thank you.

exchange_addin

Comments (0)

Skip to main content