People that are really big and into Windows PowerShell know all about Implicit Remoting. It’s a way to access Cmdlets from a Remote server and use them as if they are local.
For those of you just learning PowerShell, I’ll show you something to make that process a LITTLE bit smoother and easier.
When you are managing Exchange in Office 365 you normally end up using a process that contains these lines.
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Credentials -Authentication Basic -AllowRedirection
This process will popup a box on your screen prompting for your credentials, think about it for a bit and then eventually give you access to the Cmdlets. But we can streamline this. First let’s note something. Every single time you execute the Import-PSSession it’s going to download those Cmdlets and spin up a temporary copy.
If you would like a “cached” copy to make your life easier change this line
To read as this line
Export-PSSession $Session –outputmodule o365
This will take about the same amount of time as the first run but it will create a locally cached module containing all of those redirected Cmdlets
Now that you’ve done this, when you have to Manage the Exchange component of your Office 365 environment you can run this Cmdlet.
Running a Cmdlet will prompt with the credentials used to create the module. If you’d like to make this more portable, just go in the PSM1 file located under the O365 folder created by the module. By default this will probably be sitting under the Windows PowerShell folder within Documents under your profile.
If you’d like the path to it programmatically in Windows PowerShell that should be.
Open up the file callled “o365.psm1” in your favorite text editor
Just do a search for the userid in this file
and change it with a blank or even a generic one for technicians to replace with. It can even be words as it’s just part of a popup box for credentials
Just save this file. You can now take that O365 folder structure, zip it up and distribute it to those that need to Manage Office 365 users. You should also find it’s a bit faster on startup since you don’t need to re-load the Cmdlets from the cloud each and every time.
Occasionally Microsoft may update the Cmdlets on the Exchange side and you might have to redo this process but as you can see all of this is a scriptable and automatable process. You can rebuild the module at any time.