Am I reaching the limits of PowerShell here?

Hi there,

I am currently working to build up several tools my daily work tasks. And there’s one I’ve been avoiding, because I just have no idea how to approach it, and whether PowerShell is the language I should be using.

Reconfiguring outlook profiles to Office 365. It’s totally possible with on-premise, using a .prf, but with autodiscover, the server name is dynamic, so hard coding in a server name is not possible. I find this crazy that I can’t figure this out as I would expect it to be something the Office 365 team would want to make it possible.

I have managed to design a tool which creates a share, downloads 365 to it, deploys a GPO to the client with a customisable icon appearing on desktops, which can uninstall any version of office and re-install the new one, while displaying a beautiful little progress bar, but I can’t make a script which utilizes autodiscover… driving me crazy a bit!

Please let me know if anyone else has faced this issue and any ideas would be much appreciated!

Many Thanks,
Steven

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session

The key to this is the -AllowRedirection switch so you can go from the generic front door to the specific server for you.

Hi Bob,

Thank you for your response.

I know this would work to login to Exchange Online to configure the tenant, but surely this is a connection to the tenant administration, rather than the creation of an outlook profile which uses Office 365 AutoDiscover?

Are you suggesting I investigate how the -AllowRedirection switch has been built, and utilise it for what I’m looking at?

Hi Bob, you were right, all the information I needed was there inside the Exchange Session connection…

Thanks for pointing me in the right direction.

Glad that worked for you. Have a good weekend.