Again, I love to share things that seem to take a bunch of searching for, and in this case, trying to find a full list of commands when administering Exchange online/Office365 via Powershell. You won’t ever find a list really, because they’re changing all the time and may also be dependent on the type of tenant you have amongst other factors.
I won’t get into how to connect to Exchange Online via Powershell, but you can find all that info on this page. However, you’ll quickly learn that this setup requires both a Powershell module, as well as connecting to a remote powershell session. By doing the command connect-exchangeonline – you’re not only connecting the module, but opening a pssession to a remote Exchange server as well. The Exchangeonlinemanagement module offers a core group of commands, but you’ll realize down the road that there are MANY more commands available. Unfortunately, when you do something like get-command -module exchangeonlinemanagement, you get results like this:
Again, that’s nice and all, but there are likely 100s more commands available, how do we find those? That’s the answer I actually had a tough time finding, but here’s how:
The first way is to look at the properties of your pssession that was opened; which you can do so using get-pssession:
Ok, but we need more info. Let’s do get-pssession | select * to see all the properties of the session:
Notice an interesting property there – “CurrentModuleName”. What that did, was take a list of commands available on the remote server, and pulled them into a temporary/virtual module for Powershell to chew on. As such, we can actually use that module name to get a list of all the commands that were imported from the remote server, like this:
get-command -Module tmp_l3pyjhdx.ymi
Which then produces an enormous amount of commands (787 at the time of this writing actually):
One thing I want to point out – while this is current as of the time of this writing, it does appear that the Exchangeonlinemanagement module may be moving away from the remote sessions and moving towards using REST APIs and perhaps Graph, and it appears the current beta module, version 2.0.6 starts this journey (as Microsoft likes to put it).
While I’m on the topic – if you ever wanted to see a list of other “imported” commands, you can do so by using the -listimported parameter on get-command, like this:
get-command -listimported
That will get you a full list of imported commands from every session and every module, which you can filter against.
Hope this helps – HAPPY ADMINNING!